1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00
Files
wrestlingdev.com/app/models/tournament.rb

39 lines
570 B
Ruby

class Tournament < ActiveRecord::Base
has_many :schools, dependent: :destroy
has_many :weights, dependent: :destroy
has_many :mats, dependent: :destroy
has_many :wrestlers, through: :weights
def tournament_types
["Pool to bracket"]
end
def matches
@matches = Match.where(tournament_id: self.id)
end
def upcomingMatches
if matches.nil?
return matches
else
generateMatchups
return matches
end
end
def generateMatchups
@matches = Tournamentmatchgen.new.genMatches(self)
end
def destroyAllMatches
matches.destroy_all
end
end