app/controllers/roles_controller.rb
#
# Updates role details. Data is validated before.
#

Updates role details. Data is validated before.
Updates role details . Data is validated before .
def update
    assert_params_must_have :id
    params[:role].delete(:is_admin) unless params[:role].nil? or @role.users.empty?
    if @role.update_attributes(params[:role])
      flash[:notice] = 'Role has been successfully updated'
      redirect_to :action => 'show', :id => @role
    else
      render :action => 'edit'
    end
  end
def update assert_params_must_have :id params [ :role ] . delete ( :is_admin ) unless params [ :role ] . nil? or @role . users . empty? if @role . update_attributes ( params [ :role ] ) flash [ :notice ] = 'Role has been successfully updated' redirect_to :action => 'show' , :id => @role else render :action => 'edit' end end
Updates role details.
Updates role details .
# don't allow to change admin status if the role has any users assigned
