1
我怎样才能变成named_scope?如何将此find_by_sql转换为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
都能跟得上。得到以下错误:语法错误,意外tASSOC,期待'}' – keruilin 2010-05-26 00:57:29