SyntaxFix
Write A Post
Hire A Developer
Questions
With Rails 4 it's easy:
Foo.includes(:bar).where.not(bars: {id: nil})
See also: http://guides.rubyonrails.org/active_record_querying.html#not-conditions