Created
August 26, 2021 01:12
-
-
Save leokassio/5dd59cb32b44589e06eeb5e299d876c1 to your computer and use it in GitHub Desktop.
Sports App - Basic Data Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tournament | |
has_many :matches, inverse_of: :tournament | |
has_many :teams, through: :matches, source: :teams | |
end | |
class Team | |
has_many :team_match_participations | |
has_many :matches, through: :team_match_participations, source: :match | |
has_many :players | |
end | |
class Match | |
has_many :team_match_participations | |
has_many :teams, through: :team_match_participations | |
belongs_to :tournament | |
end | |
class TeamMatchParticipation | |
belongs_to :team | |
belongs_to :match | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Association Diagram