searchable_record gem
Gem details
Documentation
Install the Gem:
gem install searchable_record
A brief usage example:
class Item < ActiveRecord::Base include SearchableRecord end
rules = { :limit => nil, # key as a flag; the value for the key is not used :offset => nil, # key as a flag :sort => { 'name' => 'items.name', 'created' => 'items.created_at' }, :rsort => nil, # rsort is allowed according to rules in :sort (key as a flag) :since => 'items.created_at', # cast parameter value as the default type :until => 'items.created_at', # cast parameter value as the default type :patterns => { :type => 'items.type', # match the pattern with the default operator and converter :name => { :column => 'items.name', :converter => lambda { |val| "%#{val.gsub('_', '.')}%" } } } # match the pattern with the default operator } Item.find_queried(:all, params, rules)
See the gem website for details.
Edit Gem | Back in time (4 older versions) | Last edited by: tuomas, about 1 year ago


