Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

1 total

find conditions via hash

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.

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