Created
August 8, 2016 08:37
-
-
Save hrumhrumble/5d1e9b9ef39231c1482e91dcd85ebd74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update | |
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) | |
prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email) | |
resource_updated = update_resource(resource, account_update_params) | |
yield resource if block_given? | |
if resource_updated | |
if is_flashing_format? | |
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ? | |
:update_needs_confirmation : :updated | |
set_flash_message :notice, flash_key | |
end | |
sign_in resource_name, resource, bypass: true | |
respond_with resource, location: after_update_path_for(resource) | |
else | |
clean_up_passwords resource | |
respond_with resource, location: user_path(resource) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment