summaryrefslogtreecommitdiff
path: root/app/models/bracket.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/bracket.rb')
-rw-r--r--app/models/bracket.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/bracket.rb b/app/models/bracket.rb
index e8d9c5a..acd33ca 100644
--- a/app/models/bracket.rb
+++ b/app/models/bracket.rb
@@ -1,4 +1,11 @@
class Bracket < ActiveRecord::Base
belongs_to :user
belongs_to :tournament
+ has_many :bracket_matches
+
+ def create_matches
+ tournament.stages.first.matches.each do |m|
+ bracket_matches.create(match: m)
+ end
+ end
end