Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

GabesStudio's Profile

GitHub User: gabekessler

Comments by GabesStudio

Avatar

In case someone's still looking for an easy answer to searching in multiple attributes, you can set it up like the where params in scopes:

def self.search(search)
 if search
  find(:all, :conditions => ['first_name LIKE ? || last_name LIKE ? || company_name LIKE ?', "%#{search}%", "%#{search}%", "%#{search}%"])
 else
  find(:all)
 end
end