Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 注册后无法使Desive/omniauth重定向_Ruby On Rails_Ruby_Devise_Omniauth_Ruby On Rails 4.1 - Fatal编程技术网

Ruby on rails 注册后无法使Desive/omniauth重定向

Ruby on rails 注册后无法使Desive/omniauth重定向,ruby-on-rails,ruby,devise,omniauth,ruby-on-rails-4.1,Ruby On Rails,Ruby,Devise,Omniauth,Ruby On Rails 4.1,我正在尝试让designe/omniauth在注册后正确重定向用户(稍后我将尝试登录)。我使用的是omniauth Google gem,基本上我希望用户注册后发送到计划页面。我在这里和其他网站上读过好几篇文章,尝试过我能找到的每一条建议,但运气不佳。我的应用程序控制器如下所示: class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. #

我正在尝试让designe/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 routes对此进行了测试,并确认如下:

register_plans GET      /register/plans(.:format)              register#plans
我不知道还能尝试什么。我使用的是运行在Ubuntu上的rails 4.2.4和Ruby 2.2.1

任何帮助都将不胜感激

非常感谢
David

您是否已经按照routes中的要求为
用户/omniauth\u回调设置了控制器?@是的,omniauth的这一部分工作正常,只是在完成后,我总是被发送回根目录。谢谢请添加您的
users/omniauth\u回调
控制器。您是否已经按照routes中的要求为
users/omniauth\u回调
设置了控制器?@是的,我有,omniauth的这一部分工作正常,只是当它完成后,我总是被发送回根目录。谢谢请添加您的
用户/omniauth\u回调
控制器。