views:

48

answers:

1

Given the following code which creates an and condition, how do I make it create an or condition instead?

Country.first(:conditions=>{:media_code=>country_code, :code=>country_code})
+4  A: 

You can do that with array style conditions:

Country.first(:conditions => ["media_code = :code or code = :code", {:code => country_code}])
Voyta