Reputation: 8240
how could I use something like this:
@comments = @company.comments.where(:approved => true).or(:ip => request.remote_ip).all
Should I have to install any specific gem for doing this?
I using rails 3.0.4 and mysql2.
Thanks.
Upvotes: 2
Views: 419
Reputation: 159115
See the "Conditions" section in the documentation, where it explains using multiple parameters in the conditions. Your query would be written:
@comments = @company.comments.where('approved = ? OR ip = ?', true, request.remote_ip).all
Upvotes: 2