diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-16 21:05:10 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-16 21:05:10 +0000 |
commit | d69a05a6eef989301d7fb79a9521744a731dd48e (patch) | |
tree | e11d8f06794c3fb07c71df29d1c5879f683c85ef /app | |
parent | 33493f8010fd9fdd4f1d0eb914aac82c1d02d0b3 (diff) | |
download | redmine-d69a05a6eef989301d7fb79a9521744a731dd48e.tar.gz redmine-d69a05a6eef989301d7fb79a9521744a731dd48e.zip |
Rescue and display an error message when trying to delete a role that is in use.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1159 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/roles_controller.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index a8a31cd4d..4796bb7f0 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -53,12 +53,11 @@ class RolesController < ApplicationController def destroy @role = Role.find(params[:id]) - #unless @role.members.empty? - # flash[:error] = 'Some members have this role. Can\'t delete it.' - #else - @role.destroy - #end + @role.destroy redirect_to :action => 'list' + rescue + flash[:error] = 'This role is in use and can not be deleted.' + redirect_to :action => 'index' end def move |