named_scope or find_by_sql?
- by keruilin
I have three models:
User
Award
Trophy
The associations are:
User has many awards
Trophy has many awards
Award belongs to user
Award belongs to trophy
User has many trophies through awards
Therefore, user_id is a fk in awards, and trophy_id is a fk in awards.
In the Trophy model, which is an STI model, there's a trophy_type column. I want…