Rails/ActiveRecord: Syntax for “or” conditions?

You can do that in :condition options User. All(:conditions => 'xxx=? OR yyy=?', x_valu, y_value).

Are replace by escaping value.It's the first querying system before named_scope arrived – shingara Oct 20 '10 at 14:16.

Just trying to figure out how to write "or" statements in activerecord conditions without resorting to raw sql - I assume it can be done, but google isn't helping much. So, to give an example, suppose there's a model "Author" with a one-to-many relationship with 'Books' and a many-to-one relationship with 'Publisher'. How would I find all authors who have a publisher with name "Penguin" OR a book released in 2010 (or both) without resorting to SQL?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions