3

How to redirect to a specific page on successful sign up using rails devise gem?

Alexey Zakharov
  • 24,694
  • 42
  • 126
  • 197

3 Answers3

5

This page is for you: http://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in

Yannis
  • 5,426
  • 1
  • 31
  • 30
  • Yannis, you misunderstood my question. It was about sign UP not sign IN. – Alexey Zakharov Oct 07 '10 at 12:01
  • where you able to make it work ? because somehow it never seems to go through my overridden controller... Do I need to update my routes ? If I do so then I need to have another of views ? – Alex Jan 24 '11 at 14:26
2

I hope its not too late, you need to override the after_sign_up_path_for of the registration controller, create a registrations_controller.rb in your app/controller, and override said action.

registrations_controller.rb

class RegistrationsController < Devise::RegistrationsController

  def after_sign_up_path_for(resource)
    ...path of choice...
  end

end

haven't tested this code so might not work with just copy and paste. If you look here it will give you the actions for any other redirects you made need.

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

Saifis
  • 2,197
  • 1
  • 22
  • 36
0

The wiki page recently moved and the info is here: https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-and-sign-out

Dty
  • 12,253
  • 6
  • 43
  • 61