Skip to content

Instantly share code, notes, and snippets.

class District
has_many :leagues
has_many :seasons, :through => :leagues
def teams
Team.find(:all, :include => {:season => :league}, :conditions => ['leagues.district_id = ?', self.id])
end
end
class League
class District
has_many :leagues
has_many :seasons, :through => :leagues
# has_many :teams ???
end
class League
belongs_to :district
has_many :seasons