开发者

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

开发者 https://www.devze.com 2023-01-18 21:57 出处:网络
How to redirect to a specific pag开发者_高级运维e on successful sign up using rails devise gem?This page is for you: http://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-

How to redirect to a specific pag开发者_高级运维e on successful sign up using rails devise gem?


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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消