github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

innetra / acts_as_seekable

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 3
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Rails gem/plugin for custom search in models — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

[new] created gem 
Gustavo Ortíz (author)
Mon May 18 09:29:39 -0700 2009
commit  d93b9d446236079408402e39695ef0f5ae1bb49b
tree    c5ee2f6c50b0edcb85801a05323cac9aaaa7cc4d
parent  0305becd22aa93c1f8035ef31ee9ec37c7aab78f
acts_as_seekable /
name age
history
message
file MIT-LICENSE Loading commit data...
file Manifest
file README.rdoc
file Rakefile
file acts_as_seekable.gemspec
file github-test.rb
file init.rb
directory lib/
directory pkg/
README.rdoc

ActsAsSeekable

========

This plugin allows you to make your models seekable (searchable) by combining filter params with order and search params. The values in the order and search params will be used as lambda values for ordered_by and search named_scopes. Values in the filter param will be treated as named_scopes. Since this plugin works based on named_scopes, it will add an all_records and ordered_by named_scope to all models that have acts_as_seekable in them, you must create your own search named_scope for the seek (search) functionality to work and aditional named_scope for each filter you want. When sending the filter param to the seek method, it is very important that you have a named_scope called like the value of the parameter, or else it wont work. You can specify if your seach will be paginated or not, it will use mislav-will_paginate plugin to perform pagination, if you don’t that gem installed acts_as_seekable will ingnore the :paginate param.

Example

=
  Example with mislav-will_paginate:

    acts_as_seekable :paginate => true
          or
    acts_as_seekable :paginate => :true
          or
    acts_as_seekable :paginate => "true"

    named_scope :search, lambda { |search| conditions.... }

  ----------------------------------------------------------------

  Example without mislav-will_paginate:

    acts_as_seekable   #short way
          or
    acts_as_seekable :paginate => false #long way
          or
    acts_as_seekable :paginate => :false #long way
          or
    acts_as_seekable :paginate => "false" #long way

    named_scope :search, lambda { |search| conditions.... }

  -----------------------------------------------------------------

For a full example of an application working with acts_as_seekable visit

 http://github.com/gusortiz/acts_as_seekable_example

Copyright © 2009 Gustavo Adrian Ortiz Monroy, released under the MIT license

MIT license

=====

Copyright © 2009 Gustavo Adrian Ortiz Monroy

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server