diff options
Diffstat (limited to 'app/controllers/body_controller.rb')
-rw-r--r-- | app/controllers/body_controller.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/body_controller.rb index 0a267118a..ba90f317f 100644 --- a/app/controllers/body_controller.rb +++ b/app/controllers/body_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: body_controller.rb,v 1.2 2007-10-30 18:52:27 francis Exp $ +# $Id: body_controller.rb,v 1.3 2007-10-31 12:39:58 francis Exp $ class BodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL @@ -21,6 +21,9 @@ class BodyController < ApplicationController if @public_bodies.size > 1 raise "Two bodies with the same historical simplified short name: " . params[:simple_short_name] end + if @public_bodies.size == 0 + raise "None found" # XXX proper 404 + end redirect_to show_public_body_url(:simple_short_name => simplify_url_part(@public_bodies[0].short_name)) end @public_body = @public_bodies[0] |