Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matschaffer/96806 to your computer and use it in GitHub Desktop.
Save matschaffer/96806 to your computer and use it in GitHub Desktop.
class District
has_many :leagues
has_many :seasons, :through => :leagues
# If this doesn't work
has_many :teams, :through => :seasons
# How about this?
def teams
seasons.teams
end
end
class League
belongs_to :district
has_many :seasons
has_many :teams, :through => :seasons
end
class Season
belongs_to :league
has_many :teams
end
class Team
belongs_to :season
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment