summaryrefslogtreecommitdiff
path: root/app/models/bracket.rb
diff options
context:
space:
mode:
authortkimia <tkimia@purdue.edu>2014-04-26 20:14:00 -0400
committertkimia <tkimia@purdue.edu>2014-04-26 20:14:00 -0400
commite60adb874faffd9bac678a19043532ff33dc6b07 (patch)
treec2a2deac1b15bd9abadacf8393e3142549afae1d /app/models/bracket.rb
parent93e291c8e5002fdea906bb8c96cd528fa8b75935 (diff)
bracket creation is good
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