simplifies erase action

This commit is contained in:
rgarcia
2015-10-20 12:57:12 +02:00
parent 6af6a63e15
commit d54abb5dfe

View File

@@ -15,15 +15,9 @@ class Users::RegistrationsController < Devise::RegistrationsController
end end
def delete def delete
# The only difference between this version of delete and the original are the following two lines
# (we build the resource differently and we also call erase instead of destroy)
resource = current_user
current_user.erase(erase_params[:erase_reason]) current_user.erase(erase_params[:erase_reason])
sign_out
yield resource if block_given? redirect_to root_url, notice: t("devise.registrations.destroyed")
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
set_flash_message :notice, :destroyed if is_flashing_format?
respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) }
end end
def success def success