summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-29 10:34:33 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-29 10:34:33 -0400
commit3750da581ea0422bdf3f0d05c373398da5828b12 (patch)
tree28a0537c791ae3e5b11e519db1a8a942e74ac4d6 /app
parent64152ae336af48cc7b9908982f2edb0b816eaf4d (diff)
fix tournament creation
Diffstat (limited to 'app')
-rw-r--r--app/controllers/tournaments_controller.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 471c5da..0b81dd9 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -52,13 +52,11 @@ class TournamentsController < ApplicationController
# POST /tournaments
# POST /tournaments.json
def create
- @tournament = Tournament.new(tournament_attribute_params)
- @tournament.status = 0
ok = true
begin
ActiveRecord::Base.transaction do
+ ok &= @tournament = Tournament.new(tournament_attribute_params.merge({hosts: [current_user]}))
ok &= @tournament.update(tournament_setting_params)
- ok &= @tournament.hosts.push(current_user)
for i in 1..(params[:num_stages].to_i) do
begin
ok &= @tournament.stages.build(tournament_stage_params(i))