Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/models/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def after_remove(team_member)
end
end
has_many :players, through: :team_members, source: :player
has_many :matches_as_team1, class_name: "Match", foreign_key: "team1_id"
has_many :matches_as_team2, class_name: "Match", foreign_key: "team2_id"
has_many :matches_as_team1, class_name: "TournamentMatch", foreign_key: "team_a_id", dependent: :destroy
has_many :matches_as_team2, class_name: "TournamentMatch", foreign_key: "team_b_id", dependent: :destroy

# Callbacks
after_create :add_captain_as_member
Expand All @@ -35,7 +35,7 @@ def self.reset_counters(id)
end

def matches
Match.where("team1_id = ? OR team2_id = ?", id, id)
TournamentMatch.where("team_a_id = ? OR team_b_id = ?", id, id)
end

def full?
Expand Down
Loading