How transform this find_by_sql to named_scope?

Posted by keruilin on Stack Overflow See other posts from Stack Overflow or by keruilin
Published on 2010-05-25T22:28:58Z Indexed on 2010/05/25 22:31 UTC
Read the original article Hit count: 311

Filed under:
|
|

How can I possibly turn into named_scope?

def self.hero_badge_awardees
        return User.find_by_sql("select users.*, awards.*, badges.badge_type 
          from users, awards, badges 
          where awards.user_id = users.id and badges.id = awards.badge_id and badges.badge_type = 'HeroBadge'")
      end

© Stack Overflow or respective owner

Related posts about sql

Related posts about ruby-on-rails