summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-07 01:25:12 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-07 01:25:12 -0500
commitf69fcc28596700c1a875068b7cb616d6eb40e6df (patch)
treec11b97401a620f2dd7df5ae4b9645111065b0a8a /app/models
parentfd213819fa004209fc466b19ee65d83b1f918068 (diff)
It is 1:30 AM
Diffstat (limited to 'app/models')
-rw-r--r--app/models/match.rb2
-rw-r--r--app/models/tournament.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index 7dacae5..782dce8 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -3,6 +3,6 @@ class Match < ActiveRecord::Base
has_and_belongs_to_many :teams
- belongs_to :winner
+ belongs_to :winner, class_name: "Team"
end
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index ead9205..79d8b24 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -16,7 +16,7 @@ class Tournament < ActiveRecord::Base
unless joinable_by?(user)
return false
end
- players<<user
+ players.push(user)
end
def setup(tournament)
@@ -28,7 +28,7 @@ class Tournament < ActiveRecord::Base
match_num = 0
team_num = 0
self.players.each_slice(tournament.max_players_per_team) do |players|
- self.matches[match_num].teams[team_num] = Team.new(users: players)
+ self.matches[match_num].teams.push(Team.create(users: players))
if (team_num == 0 and team_num % tournament.max_teams_per_match == 0)
match_num += 1
team_num = 0