From c342d0d9cf43c05236ed162f77656542d902adad Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 23 Apr 2014 10:45:51 -0400 Subject: fix the nil bug from last night --- app/controllers/matches_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app') 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 -- cgit v1.2.3-2-g168b