Find Conditions via Hash


/ Published in: Rails
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. Event.find(
  2. :all,
  3. :conditions => [ "title like :search or description like :search",
  4. {:search => "%Tiki%"}]
  5. )

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.