app/controllers/users_controller.rb
#
# Removes user after confirmation
# Administrators +can't+ be removed using this method
#

Removes user after confirmation
Administrators +can't+ be removed using this method
Removes user after confirmation Administrators + can ' t + be removed using this method
def destroy
    assert_params_must_have :id
    if @user.is_admin?
      flash[:error] = "Admin can't be deleted"
      redirect_to :action => "list" and return
    end
    if params[:name_confirmation] == @user.name
      @user.destroy ? flash[:notice] = 'User and his activities have been deleted' : 
                      flash[:error] = 'Error occured while deleting user'
    else
      flash[:error] = "The user has not been deleted, since the name was different" 
    end
    redirect_to :action => 'list'
  end
def destroy assert_params_must_have :id if @user . is_admin? flash [ :error ] = "Admin can't be deleted" redirect_to :action => "list" and return end if params [ :name_confirmation ] == @user . name @user . destroy ? flash [ :notice ] = 'User and his activities have been deleted' : flash [ :error ] = 'Error occured while deleting user' else flash [ :error ] = "The user has not been deleted, since the name was different" end redirect_to :action => 'list' end
Removes user after confirmation
Administrators +can't+ be removed using this method
Removes user after confirmation Administrators + can ' t + be removed using this method
# Check if we are not trying to remove admin
 # Check if confirmation matches
