IF you really need to search over several columns, use concat() for db
columns... like
scope :search, labda{|search| where("concat(name, genre, console) like ?",
"%#{search}%").presence || all }
and then use
Model.search('value')
tom
On Feb 21, 2012, at 16:44 , Roger Patrick wrote:
> I am c
I am currently writing a search method for my rails applications and at
the moment it works fine. I have the following in my game.rb:
def self.search(search)
if search
find(:all, :conditions => ['name LIKE ? OR genre LIKE ? OR
console LIKE ?', "%#{search}%", "#{search}", "#{search}"])
else
I am currently writing a search method for my rails applications and at
the moment it works fine. I have the following in my game.rb:
def self.search(search)
if search
find(:all, :conditions => ['game_name LIKE ? OR genre LIKE ? OR
console LIKE ?', "%#{search}%", "#{search}", "#{search}"])
3 matches
Mail list logo