开发者

Rails 3. Device and Omniauth post signup redirection

I am developing a user application in Rails 3 and I am using D开发者_Python百科evice and Omniauth for signup. After a user have signed up using Devise I want to either redirect to a page of my choice or create a new Profile automatically for the user.

How can I choose which URL to redirect to directly after signup (not sign in)?

Thankful for all help!


Please take a look here:

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-(registration)

In my application I use following code to redirect when user sign_up

class RegistrationsController < Devise::RegistrationsController
  # information why this controller exist:
  # https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-(registration)

  def thank_you
  end

  protected
  def after_sign_up_path_for(resource)
    "http://some.kind.of.url/hello"
  end

  def after_inactive_sign_up_path_for(resource)
    url_for(:controller => :registrations, :action => :thank_you)
  end
end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜