How change update user failure route passing devise errors?
Here is my controller code to replace devise registration update:
class RegistrationsController < Devise::RegistrationsController
def edit
render :edit
end
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
bypass_sign_in resource, scope: resource_name
respond_with resource, location: after_update_path_for(resource)
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource, location: profile_member_users_path(resource)
end
end
def after_update_path_for(resource)
profile_member_users_path(resource)
end
end
I trying change:
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource
To
else
clean_up_passwords resource
set_minimum_password_length
redirect_to profile_member_users_path(resource)
But this don't pass devise errros to the view.