Reputation: 11107
How do I write a where clause where I have a where argument that can take multiple options. For example,
User.where(name: "Jason" OR name: "Bob")
Although I know that isn't the correct syntax, what is?
Upvotes: 0
Views: 254
Reputation: 1852
I'm always late to the party...
friends = User.where(:name => ["Jason", "Bob"])
(Rails 4.0.0)
Upvotes: 0
Reputation: 46667
While I don't have a console to hand to check, I'm pretty sure it's:
User.where(name: ["Jason", "Bob"])
Upvotes: 3