= SimpleSearch SimpleSearch privides search methods for your ActiveRecord models, by providing methods that allow you to search, group, and order. Main goal is to simplify all search related operations from url. * Searching * Paging * Grouping * Ordering == Getting Started In your Gemfile: gem "simple-search" # Last officially released gem # gem "simple-search", :git => "git://github.com/bighostkim/simple-search.git" In your controller: def index @posts = Post.simplesearch(params) # or, @posts = Post.simplesearch(params[:ss]) # when group options to "ss" # or, @posts = Post.simplesearch(:id_gt=>1,:id_lt=>3) end In your view: <%= form_tag('/posts') do -%> <%= text_field_tag 'id_gt' %> <%= text_field_tag 'id_lt' %> ..... <%= submit_tag %> <% end -%> <%=order_link(:id, "Order by ID" )%> <%=page_urls(@posts)%> === Search postfixes * _eq, equal to, = * _gt, greater than, > * _lt, less than, < * _le, less or equal to, <= * _ge, greater or equal to, <= * _in, includes, IN i.e., &id_in=1,2,3 * _bt(_between), between, BETWEEN i.e., &id_between=1,3 * _sw(_startswith), starts with, LIKE 'key%' ( * _ew(_endsswith), ends with, LIKE '%key' * _ct(_contains,_like), contains, LIKE '%key%' * _nc(_notcontains,_notlike), not contains, NOT LIKE '%key%' * _is, IS i.e., &id_is=null * _it(_isnot), IS NOT === Sorting your result * order_by i.e., &order_by=id+asc === Paging * page , page number i.e. &page=1 * page_by, number of rows in a page i.e. &page_by=10 == Contributing to simple-search * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet. * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it. * Fork the project. * Start a feature/bugfix branch. * Commit and push until you are happy with your contribution. * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. == Copyright Copyright (c) 2012 Allen Kim. See LICENSE.txt for further details.