Reputation: 197
How can I achieve something like this in Rails (if there is a way) with hash parameters without writing a where string:
Model.where(**:launched => nil or false**, :verify => false, :pools => {:status => 'later'})
Upvotes: 1
Views: 98
Reputation: 2399
Model.where(:launched => [nil, false], :verify => false, :pools => {:status => 'later'})
Now you will query for all objects where :launched is nil or false.
P.s. Ditch the hash rockets and use the cleaner Ruby 1.9+ syntax, unless of course you want to stick with ruby 1.8.7 or earlier. For example: Model.where(launched: [nil, false])
Upvotes: 6