Ver código fonte

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
tags/0.7.0-RC1
Jean-Philippe Lang 16 anos atrás
pai
commit
d69a05a6ee
1 arquivos alterados com 4 adições e 5 exclusões
  1. 4
    5
      app/controllers/roles_controller.rb

+ 4
- 5
app/controllers/roles_controller.rb Ver arquivo

@@ -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

Carregando…
Cancelar
Salvar