aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/body_controller.rb
diff options
context:
space:
mode:
authorfrancis <francis>2007-10-31 12:39:58 +0000
committerfrancis <francis>2007-10-31 12:39:58 +0000
commitaf4055e002f7d9b12ec492e1a9b78a6a6aff5bb3 (patch)
treef59c9c1c0871bb03a7af1472bda6a67cc469005e /app/controllers/body_controller.rb
parentc023cfab330de526892126ae722d7bfcc1d22c96 (diff)
Tests for some controllers.
Diffstat (limited to 'app/controllers/body_controller.rb')
-rw-r--r--app/controllers/body_controller.rb5
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]