How to get non-flagged users
This gets me all 开发者_JS百科users who are flagged:
User.joins(:flags)
How would I do the opposite of above?
Try something like:
User.find(:all,
:joins => 'LEFT JOIN flags ON users.flag_id=flags.id',
:group => 'users.id',
:having => 'flags.id IS NULL')
精彩评论