Skip to content

How To: Redirect to a specific page on successful sign up (registration)

cailinanne edited this page Jul 12, 2011 · 7 revisions

The proposed way is available since Devise 1.2.rc.

1. Make a new controller "Registrations" and customize the appropriate method:

class RegistrationsController < Devise::RegistrationsController
  protected

  def after_sign_up_path_for(resource)
    some_special_page
  end
end

If the account that is registered is not active yet, you have to override after_inactive_sign_up_path_for method.

class RegistrationsController < Devise::RegistrationsController
  protected

  def after_inactive_sign_up_path_for(resource)
    some_special_page
  end
end

You can see the whole lists of methods to customize on Devise source:

https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb

2. Modify config/routes.rb to use the new controller

devise_for :users, :controllers => { :registrations => "registrations" }

Note: After changing the controller in the config/routes.rb file, you will want to copy over the devise registration views over to the new app/views/registrations path.

Clone this wiki locally