Posted By

sohooo on 02/06/09


Tagged

model find


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


Find Conditions via Hash


 / Published in: Rails
 

Instead of simply adding a list of things at the end of the array, you can also pass in a hash and change the question marks to actual named replacements. This can help you keep the order of your arguments straight.

  1. Event.find(
  2. :all,
  3. :conditions => [ "title like :search or description like :search",
  4. {:search => "%Tiki%"}]
  5. )

Report this snippet  

You need to login to post a comment.