app/controllers/users_controller.rb
#DELETE /profile
#allows a user to delete their own account
DELETE /profile
allows a user to delete their own account
DELETE / profile allows a user to delete their own account
def destroy_own
    unless @current_user.has_role?("administrator") ||  @current_user.has_role?("super user")
      if @current_user.destroy
        flash[:notice] = t('devise.registrations.destroyed')
      else
        flash[:error] = t('.error')
      end
    else
      flash[:error] = t('users.destroy.admins_cannot_be_destroyed')
    end
    redirect_to :root
  end
def destroy_own unless @current_user . has_role? ( "administrator" ) || @current_user . has_role? ( "super user" ) if @current_user . destroy flash [ :notice ] = t ( 'devise.registrations.destroyed' ) else flash [ :error ] = t ( '.error' ) end else flash [ :error ] = t ( 'users.destroy.admins_cannot_be_destroyed' ) end redirect_to :root end
DELETE /profile
allows a user to delete their own account
DELETE / profile allows a user to delete their own account