From 3750da581ea0422bdf3f0d05c373398da5828b12 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 29 Apr 2014 10:34:33 -0400 Subject: fix tournament creation --- app/controllers/tournaments_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 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)) -- cgit v1.2.3