summaryrefslogtreecommitdiff
path: root/app/controllers/tournaments_controller.rb
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-23 19:32:28 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-23 19:32:28 -0400
commit734729119cbc31e847fd46609b598573f365bdc4 (patch)
tree020227b1357fc406fe6373e2aa97c042c60f8dac /app/controllers/tournaments_controller.rb
parentd0a0f806a4bb8072c532ea7b35ad8b7643ac8645 (diff)
tournaments: unify params[:game] and params[:tournament][:game_id]
Diffstat (limited to 'app/controllers/tournaments_controller.rb')
-rw-r--r--app/controllers/tournaments_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 03dc5b8..3835a59 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -32,7 +32,11 @@ class TournamentsController < ApplicationController
# GET /tournaments/new
def new
@games = Game.all
- @tournament = Tournament.new(game: Game.find_by_id(params[:game]))
+ if params[:tournament]
+ @tournament = Tournament.new(game: Game.find(params[:tournament][:game_id]))
+ else
+ @tournament = Tournament.new()
+ end
end
# GET /tournaments/1/edit
@@ -146,7 +150,7 @@ class TournamentsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def tournament_params
- params.require(:tournament).permit(:game, :game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method)
+ params.require(:tournament).permit(:game_id, :status, :name, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :sampling_method)
end
def is_owner?(object)