注册后无法获得设计/ omniauth重定向

时间:2015-09-07 12:08:39

标签: ruby-on-rails ruby devise omniauth ruby-on-rails-4.1

我正在尝试使用devise / omniauth在注册后正确地重定向用户(稍后我将尝试登录)。我正在使用omniauth Google gem,基本上我希望用户一旦注册就被发送到计划页面。我已经在这里和其他网站上阅读了几件事情,并尝试了我能找到的所有建议,但没有运气。我的应用程序控制器如下:

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  private

  def stored_location_for(resource)
    nil
  end

  def after_sign_in_path_for(resource)
    request.env['omniauth.origin'] || stored_location_for(resource) || root_path
  end

  def after_sign_up_path_for(resource)
    'register#plans' # Or :prefix_to_your_route
  end

  def after_inactive_sign_up_path_for(resource)
    'register#plans' # Or :prefix_to_your_route
  end
end

我不需要激活,但我已经测试了非活动注册以及注册以防万一。我没有使用自定义注册控制器或任何东西,我的设计路线如下:

devise_for :users, :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' }

我的计划路线也是这样注册的:

get 'register/plans'

我用rake路线对此进行了测试,确认为:

register_plans GET      /register/plans(.:format)              register#plans

我无法尝试其他什么。我在Ubuntu上运行rails 4.2.4和Ruby 2.2.1。

非常感谢任何帮助。

非常感谢 大卫

0 个答案:

没有答案