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 })
根据上述准则,可在<代码>上添加一个OR条款:conditions ,以表示类似情况。
where (pets.id is NULL AND users.status IN ( sick , healthy , hungry )) OR (users.gender = male )