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
This commit is contained in:
parent
33493f8010
commit
d69a05a6ee
@ -53,12 +53,11 @@ class RolesController < ApplicationController
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@role = Role.find(params[:id])
|
@role = Role.find(params[:id])
|
||||||
#unless @role.members.empty?
|
@role.destroy
|
||||||
# flash[:error] = 'Some members have this role. Can\'t delete it.'
|
|
||||||
#else
|
|
||||||
@role.destroy
|
|
||||||
#end
|
|
||||||
redirect_to :action => 'list'
|
redirect_to :action => 'list'
|
||||||
|
rescue
|
||||||
|
flash[:error] = 'This role is in use and can not be deleted.'
|
||||||
|
redirect_to :action => 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
def move
|
def move
|
||||||
|
Loading…
x
Reference in New Issue
Block a user