Find by multiple conditions in rails

Viewed 20188

I want to search a table with multiple conditions in Rails. I am using Active record and rails version 3.1.0.

I have Movies object, and want to achieve the equivalent of the following in rails:

Select * from Movies where rating = 'R' OR rating = 'PG'

I tried the following but it does not work

@filtered = Movies.find(:all, :conditions => { :rating => 'R', :rating => 'PG' })

Can you please provide help to write an equivalent of SQL query mentioned above.

4 Answers
Related