Created
          October 18, 2010 18:41 
        
      - 
      
- 
        Save ukstudio/632769 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # 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