diff options
author | tkimia <tkimia@purdue.edu> | 2014-04-26 20:14:00 -0400 |
---|---|---|
committer | tkimia <tkimia@purdue.edu> | 2014-04-26 20:14:00 -0400 |
commit | e60adb874faffd9bac678a19043532ff33dc6b07 (patch) | |
tree | c2a2deac1b15bd9abadacf8393e3142549afae1d /app/models/bracket.rb | |
parent | 93e291c8e5002fdea906bb8c96cd528fa8b75935 (diff) |
bracket creation is good
Diffstat (limited to 'app/models/bracket.rb')
-rw-r--r-- | app/models/bracket.rb | 7 |
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 |