From e60adb874faffd9bac678a19043532ff33dc6b07 Mon Sep 17 00:00:00 2001 From: tkimia Date: Sat, 26 Apr 2014 20:14:00 -0400 Subject: bracket creation is good --- app/models/bracket.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/models') 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 -- cgit v1.2.3-2-g168b