mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-31 11:35:45 +00:00
23 lines
490 B
Ruby
23 lines
490 B
Ruby
class Tournament < ActiveRecord::Base
|
|
has_many :schools, dependent: :destroy
|
|
has_many :weights, dependent: :destroy
|
|
has_many :matches, dependent: :destroy
|
|
has_many :mats, dependent: :destroy
|
|
|
|
def generateMatches
|
|
destroyAllMatches
|
|
self.weights.each do |weight|
|
|
puts weight.inspect
|
|
weight.generatePool
|
|
end
|
|
end
|
|
|
|
def destroyAllMatches
|
|
@matches_all = Match.where(tournament_id: self.id)
|
|
@matches_all.each do |match|
|
|
match.destroy
|
|
end
|
|
end
|
|
|
|
end
|