Displaying 1 result from an estimated 1 matches for "user_programs".
2010 Jan 25
0
has_many, :finder_sql, setting attributes
...tiple teams, but Teams belong to one
program. For each Program a User belongs 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 A...