Rails - Find Condition of two model fields

Posted by ChrisWesAllen on Stack Overflow See other posts from Stack Overflow or by ChrisWesAllen
Published on 2010-06-15T15:59:53Z Indexed on 2010/06/15 16:02 UTC
Read the original article Hit count: 243

Filed under:
|
|

I'm trying to find the results of a model where it queries as the result of two conditions.

I have a search tag that looks for

 Model.find(:all, :conditions => "name LIKE params[search]")

but I'd like for the search to find all records where "name LIKE params[search] or description LIKE params[search] .

Is there any way to add an OR into a condition in rails?

or should I make an if statement?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about find