"select * from users, awards where (users.id = awards.use开发者_如何学JAVAr_id) and awards.trophy_id not in (select awards.trophy_id from awards where awards.trophy_id = #{trophy.id})"
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 ] } }
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论