summaryrefslogtreecommitdiff
path: root/app/controllers/tournaments_controller.rb
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-23 19:32:53 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-23 19:32:53 -0400
commitd0ff792fa930a322f38338bd4de86712eca6eea9 (patch)
tree9d772ad81fb0f437659fc75b37d5f21f8073a1a5 /app/controllers/tournaments_controller.rb
parent734729119cbc31e847fd46609b598573f365bdc4 (diff)
tournaments_controller: permit game settings through
Diffstat (limited to 'app/controllers/tournaments_controller.rb')
-rw-r--r--app/controllers/tournaments_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 3835a59..b276368 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -150,7 +150,12 @@ class TournamentsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def tournament_params
- 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)
+ permitted = [: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]
+ if params[:tournament][:game_id]
+ game = Game.find(params[:tournament][:game_id])
+ permitted.push(:settings => game.settings.collect{|s| s.name})
+ end
+ params.require(:tournament).permit(permitted)
end
def is_owner?(object)