class Users::RegistrationsController
Updated Registrations Controller provided by rockstart
Public Instance Methods
destroy() { |resource| ... }
click to toggle source
DELETE /users
# File lib/generators/rockstart/authorization/devise/templates/controllers/registrations_controller.rb, line 29 def destroy resource.soft_delete Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name) set_flash_message :notice, :destroyed yield resource if block_given? respond_with_navigational(resource) { redirect_to after_sign_out_path_for(resource_name) } end
Protected Instance Methods
account_update_params()
click to toggle source
Calls superclass method
# File lib/generators/rockstart/authorization/devise/templates/controllers/registrations_controller.rb, line 82 def account_update_params super.tap do |params| # Ensure password confirmation is included with password params[:password_confirmation] ||= "" if params[:password].present? end end
after_sign_out_path_for(_resource)
click to toggle source
The path used after deleting account
# File lib/generators/rockstart/authorization/devise/templates/controllers/registrations_controller.rb, line 59 def after_sign_out_path_for(_resource) new_user_registration_path end
configure_account_update_params()
click to toggle source
If you have extra params to permit, append them to the sanitizer.
# File lib/generators/rockstart/authorization/devise/templates/controllers/registrations_controller.rb, line 54 def configure_account_update_params devise_parameter_sanitizer.permit(:account_update, keys: %i[name]) end
update_resource(resource, params)
click to toggle source
Allow the user to edit their account without providing a password
Calls superclass method
# File lib/generators/rockstart/authorization/devise/templates/controllers/registrations_controller.rb, line 74 def update_resource(resource, params) if account_update_params[:password].blank? resource.update_without_password(params) else super end end