views:

43

answers:

1

"select * from users, awards where (users.id = awards.user_id) and awards.trophy_id not in (select awards.trophy_id from awards where awards.trophy_id = #{trophy.id})"

A: 

Answered own question:

named_scope :not_awarded_trophy, lambda { |trophy| { :include => :awards, :conditions => [ "awards.trophy_id not in (select awards.trophy_id from awards where awards.trophy_id = ?)", trophy.id ] } }

keruilin