Is there a way to write it in a more ‘Rails-friendly’ way?
i.e. if I were searching for anyone of those attributes, I would just do Feedback.where(:poster_id => 3) and it would be good.
But how do I achieve the OR in the Rails 3 friendly syntax (as opposed to the SQL friendly one).
Also, if it is better to use my original one over the desired one, why is it better?
Thanks.
Edit 1: Btw, if I do Feedback.where(:poster_id => 3, :receiver_id => 3) that returns the result for the AND operation, which is the exact opposite of what I want. So I feel so close, just not quite there.
You can do this by putting SQL fragments in the where() arguments. For more information you can look at the ActiveRecord querying guide.
You can do this without SQL fragments as described in this SO post: