Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created October 18, 2010 18:41
Show Gist options
  • Save ukstudio/632769 to your computer and use it in GitHub Desktop.
Save ukstudio/632769 to your computer and use it in GitHub Desktop.
# coding: utf-8
module Searchable
def search(params={})
return self.scoped if params.nil?
params.reject{|k,v|v.blank?}.to_a.inject(self.scoped) do |base,param|
base.send(param.first, param.last)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment