Ruby on rails 使用Desive&;重新注册后重定向;Omniauth

Ruby on rails 使用Desive&;重新注册后重定向;Omniauth,ruby-on-rails,devise,omniauth,Ruby On Rails,Devise,Omniauth,我一直在尝试将我的应用程序设置为将新注册/注册重定向到我应用程序中的特定路径。我使用了Desive文档,建议在app/controllers/users/中创建注册控制器,然后使用 def after_sign_up_path_for(resource) show_cities_path(resource) end 但我没有任何运气,即使在编辑了routes文件以包含它之后 devise_for :users, :controllers => { :omniauth_callbac

我一直在尝试将我的应用程序设置为将新注册/注册重定向到我应用程序中的特定路径。我使用了Desive文档,建议在app/controllers/users/中创建注册控制器,然后使用

def after_sign_up_path_for(resource)
 show_cities_path(resource)
end
但我没有任何运气,即使在编辑了routes文件以包含它之后

  devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks", :registrations => "users/registrations" }
我目前正在使用Twitter Omniauth和Desive

我的路由文件如下所示:

Rails.application.routes.draw do

 devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" }
结束

class OmniAuthCallbackController:身份验证
其他的
会话[“designe.twitter\u uid”]=request.env[“omniauth.auth”]
将\重定向到新\用户\注册\ url
结束
结束
结束
谁能推荐一种替代方法或告诉我哪里出了问题


编辑:抱歉,可能不清楚。我已经使用Desive和Omniauth设置了用户模型。这是对新注册的覆盖

经过研究,我发现designe在使用Omniauth()时无法正确重定向

所以我在我的应用程序_controller.rb中实现了这一点

def after_sign_in_path_for(resource_or_scope)
    if resource.sign_in_count == 1
       new_product_path
    else
       root_path
    end
end

在他们第一次登录时,它会将他们重定向到方法第3行中您想要的路径

经过研究,我发现designe在使用Omniauth()时无法正确重定向

所以我在我的应用程序_controller.rb中实现了这一点

def after_sign_in_path_for(resource_or_scope)
    if resource.sign_in_count == 1
       new_product_path
    else
       root_path
    end
end

在他们第一次登录时,它会将他们重定向到方法第3行中您想要的路径

经过研究,我发现designe在使用Omniauth()时无法正确重定向

所以我在我的应用程序_controller.rb中实现了这一点

def after_sign_in_path_for(resource_or_scope)
    if resource.sign_in_count == 1
       new_product_path
    else
       root_path
    end
end

在他们第一次登录时,它会将他们重定向到方法第3行中您想要的路径

经过研究,我发现designe在使用Omniauth()时无法正确重定向

所以我在我的应用程序_controller.rb中实现了这一点

def after_sign_in_path_for(resource_or_scope)
    if resource.sign_in_count == 1
       new_product_path
    else
       root_path
    end
end

在他们第一次登录时,它会将他们重定向到方法第3行中您想要的路径

你看过这个教程吗?@kendotwill是的。对不起,我可能不太清楚。用户模型与Desive&Omniauth完美配合。我一直在尝试在新用户注册时覆盖重定向。在中为方法注册后,
的哪个控制器执行?我想你应该把它移到应用程序控制器上。@KienThanh它住在RegistrationControllerdesign\u for:users,:controllers=>{:registrations=>“users/registrations”}
。有关详细信息,请查看。您看过本教程吗?@kendotwill是的。对不起,我可能不太清楚。用户模型与Desive&Omniauth完美配合。我一直在尝试在新用户注册时覆盖重定向。在中为方法注册后,
的哪个控制器执行?我想你应该把它移到应用程序控制器上。@KienThanh它住在RegistrationControllerdesign\u for:users,:controllers=>{:registrations=>“users/registrations”}
。有关详细信息,请查看。您看过本教程吗?@kendotwill是的。对不起,我可能不太清楚。用户模型与Desive&Omniauth完美配合。我一直在尝试在新用户注册时覆盖重定向。在中为方法注册后,
的哪个控制器执行?我想你应该把它移到应用程序控制器上。@KienThanh它住在RegistrationControllerdesign\u for:users,:controllers=>{:registrations=>“users/registrations”}
。有关详细信息,请查看。您看过本教程吗?@kendotwill是的。对不起,我可能不太清楚。用户模型与Desive&Omniauth完美配合。我一直在尝试在新用户注册时覆盖重定向。在中为方法注册后,
的哪个控制器执行?我想你应该把它移到应用程序控制器上。@KienThanh它住在RegistrationControllerdesign\u for:users,:controllers=>{:registrations=>“users/registrations”}
。查看更多信息。