statuses = %w(sick healthy hungry)
query = User.scoped(:joins => 'left outer join pets on pets.user_id = users.id', :conditions => { 'pets.id' => nil, 'users.job_status' => stati })
Given the code above, is it possible to add an OR clause to the :conditions to say something like
where (pets.id is NULL AND users.status IN ('sick', 'healthy', 'hungry')) OR (users.gender = 'male')
You can do the following using the MetaWhere gem
The
|symbol is used forORcondition.PS : The
includedirective usesLEFT OUTER JOINso there is no need to hand code the JOIN.