diff --git a/app/models/tournament.rb b/app/models/tournament.rb index a670fc0..05a9285 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -3,6 +3,7 @@ class Tournament < ActiveRecord::Base has_many :weights, dependent: :destroy has_many :matches, dependent: :destroy has_many :mats, dependent: :destroy + has_many :wrestlers, through: :weights attr_accessor :upcomingMatches, :unfinishedMatches serialize :matchups_array diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb index a9d1107..15a88c2 100644 --- a/app/models/wrestler.rb +++ b/app/models/wrestler.rb @@ -1,6 +1,7 @@ class Wrestler < ActiveRecord::Base belongs_to :school belongs_to :weight + has_one :tournament, through: :weight attr_accessor :allMatches, :isWrestlingThisRound, :boutByRound, :seasonWinPercentage def isWrestlingThisRound(matchRound)