app/controllers/roles_controller.rb
def destroy
    assert_params_must_have :id

    unless @role.users.empty?
      flash[:error] = "You can't delete a role that has users assigned to it."
      return redirect_to(:action => 'list')
    end

    if params[:name_confirmation] == @role.name
      if @role.destroy
        flash[:notice] = 'Role has been deleted'
      else
        flash[:error] = 'Error occured while deleting role'
      end
    else
      flash[:error] = 'The role has not been deleted, since the name was different'
    end

    redirect_to :action => 'list'
  end
#
# Removes role. Not allowed.
#

Removes role. Not allowed.
Removes role . Not allowed .
def destroy
    assert_params_must_have :id
    unless @role.users.empty?
      flash[:error] = "You can't delete a role that has users assigned to it."
      return redirect_to(:action => 'list')
    end
    if params[:name_confirmation] == @role.name
      if @role.destroy
        flash[:notice] = 'Role has been deleted'
      else
        flash[:error] = 'Error occured while deleting role'
      end
    else
      flash[:error] = 'The role has not been deleted, since the name was different'
    end
    redirect_to :action => 'list'
  end
def destroy assert_params_must_have :id unless @role . users . empty? flash [ :error ] = "You can't delete a role that has users assigned to it." return redirect_to ( :action => 'list' ) end if params [ :name_confirmation ] == @role . name if @role . destroy flash [ :notice ] = 'Role has been deleted' else flash [ :error ] = 'Error occured while deleting role' end else flash [ :error ] = 'The role has not been deleted, since the name was different' end redirect_to :action => 'list' end
Removes role.
Removes role .