diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-19 22:20:35 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-19 22:20:35 -0400 |
commit | fdca9f33aadea4f139619f35e992760a0355d007 (patch) | |
tree | 2bdb06ba11f0f4cde139572e30c3b8a247fa408d /app/controllers/tournaments_controller.rb | |
parent | e681498867d6007caa45ab9312057acb5303f609 (diff) |
redirect is slightly more intelligent
Diffstat (limited to 'app/controllers/tournaments_controller.rb')
-rw-r--r-- | app/controllers/tournaments_controller.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index bb1d222..57e73aa 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -127,12 +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 + begin + @tournament = Tournament.find(params[:id]) + rescue + redirect_to tournaments_url, notice: 'That tournament no longer exists.' end - @tournament = Tournament.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. @@ -148,4 +147,5 @@ class TournamentsController < ApplicationController def check_edit set_tournament end + end |