diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-04-23 10:45:51 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-04-23 10:45:51 -0400 |
commit | c342d0d9cf43c05236ed162f77656542d902adad (patch) | |
tree | c8b7d7e59c3d9a91fde1a4f3de457b030a77a027 | |
parent | 8aadbcc02b1af4aab316fe752e0138548c396710 (diff) |
fix the nil bug from last night
-rw-r--r-- | app/controllers/matches_controller.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index b50aca5..254f797 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -3,6 +3,8 @@ class MatchesController < ApplicationController require 'json' require 'delayed_job' + before_action :set_tournament, only: [:index] + # GET /tournaments/1/matches # GET /tournaments/1/matches.json def index @@ -236,6 +238,9 @@ class MatchesController < ApplicationController @match = Match.find(params[:id]) @tournament = @match.tournament_stage.tournament end + def set_tournament + @tournament = Tournament.find(params[:tournament_id]) + end # Never trust parameters from the scary internet, only allow the white list through. def match_params |