diff options
author | francis <francis> | 2008-08-14 08:09:39 +0000 |
---|---|---|
committer | francis <francis> | 2008-08-14 08:09:39 +0000 |
commit | 45a3949b32ac0de93ebc8aa0b63c3976a2926542 (patch) | |
tree | f60e42d90f39ef1360a4dc1d46c3f0c50c21c5eb /app/controllers/admin_public_body_controller.rb | |
parent | 32dd7738dbda4f020b77b38f3f39dd65babdcd3a (diff) |
Only show destroy button if there are no requests.
Diffstat (limited to 'app/controllers/admin_public_body_controller.rb')
-rw-r--r-- | app/controllers/admin_public_body_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index 58432d8a9..36a310a8a 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_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: admin_public_body_controller.rb,v 1.17 2008-07-28 18:04:38 francis Exp $ +# $Id: admin_public_body_controller.rb,v 1.18 2008-08-14 08:09:39 francis Exp $ class AdminPublicBodyController < ApplicationController layout "admin" @@ -61,6 +61,13 @@ class AdminPublicBodyController < ApplicationController def destroy public_body = PublicBody.find(params[:id]) + + if public_body.info_requests.size > 0 + flash[:notice] = "There are requests associated with the authority, so can't destroy it" + redirect_to admin_url('body/show/' + public_body.id.to_s) + return + end + public_body.tag_string = "" public_body.destroy flash[:notice] = "PublicBody was successfully destroyed." |