Skip to content

Instantly share code, notes, and snippets.

@thoughtbot
Created August 4, 2009 21:22
Show Gist options
  • Save thoughtbot/161556 to your computer and use it in GitHub Desktop.
Save thoughtbot/161556 to your computer and use it in GitHub Desktop.
users = query.find(:cname => "thoughtbot")
</code></pre>
Now, what's tricky is that you could pass any syntax-changing value to that and you'd get the right SQL in the executed query.
<filter:code lang="ruby">
query.find :cname => "thoughtbot" # => company.name = "thoughtbot"
query.find :cname => nil # => company.name IS NULL
query.find :cname => ["Google", "37 Signals"] # => company.name IN ("Google", "37 Signals")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment