From 51cec17b7e4aa6291c3fb19bd74cc4dee42eba60 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Thu, 17 Apr 2014 18:41:18 -0400 Subject: redirection --- app/controllers/tournaments_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/controllers/tournaments_controller.rb') diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index f572248..bb1d222 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -127,6 +127,11 @@ class TournamentsController < ApplicationController private # Use callbacks to share common setup or constraints between actions. def set_tournament + if @tournament.nil? + respond_to do |format| + format.html { redirect_to @tournament, notice: 'That tournament no longer exists.' } + end + end @tournament = Tournament.find(params[:id]) end -- cgit v1.2.3-2-g168b