How to do this sql with pure activerecord (rails)
I can't figure out how to manage this purely with active record. I understand it doesn't handle outer joins...
SQL:
SELECT * FROM people
LEFT OUTER JOIN responses
ON people.id = respo开发者_运维问答nses.person_id
WHERE responses.person_id is NULL;
MODELS:
Person
id
has_many :responses
Response
id
belongs_to :person
Any suggestions?
named_scope :without_responses, :include => :responses,
:conditions => "responses.id IS NULL"
精彩评论