Skip to content

How To: Customize the redirect after a user edits their profile

daveganly edited this page Sep 20, 2010 · 11 revisions

Normally, after a user edits their profile they are redirected to the root_path. To have Devise redirect to a custom route after an update, follow these steps:

You can add the method after_update_path_for(resource) to your application_controller.rb file:

def after_update_path_for(resource)
  edit_user_registration_path # You can put whatever path you want here
end

Alternatively:

  1. Make sure you already have a copy of the registrations_controller.rb from Devise in your /app/controllers directory
  2. Anywhere on the file. Include this method
def after_update_path_for(resource)
  edit_user_registration_path # You can put whatever path you want here
end

The above code, will redirect the user back to the edit page, after the form submits.

Clone this wiki locally