Displaying 1 result from an estimated 1 matches for "user_teams".
2010 Jan 25
0
has_many, :finder_sql, setting attributes
...s to, he can belong to multiple
Teams. (Think of this in an athletic context where users are athletes,
programs are universities). So my models look something like this:
class User < ActiveRecord::Base
has_many :user_programs
has_many :programs, :through => :user_programs
has_many :user_teams, :finder_sql => ''SELECT ut.* FROM user_teams AS ut
JOIN user_programs AS up ON
up.user_program_id = ut.user_program_id
JOIN users AS u ON up.user_id =
u.user_id
WHER...