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.
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
精彩评论