在路由中,我的根路径指向 "home#index"
但是当我尝试使用 after_sign_up_path_for 覆盖它时,当我登录或注册时,它会不断将我重定向到根路径。我试图将它放在设计子类 Controller 和 application_controller 中,但它没有用。我需要在这里做什么?
应用 Controller
class ApplicationController < ActionController::Base
protect_from_forgery
def after_sign_up_path_for(resource)
show_cities_path(resource)
end
end
注册 Controller
class RegistrationsController < ApplicationController
def after_sign_up_path_for(resource)
show_cities_path(resource)
end
end
路线
root :to => "home#index"
最佳答案
您是否通过执行 rake routes
检查您的 show_cities_path 是否存在?可能值得一看 https://github.com/plataformatec/devise/wiki/How-To:-Change-the-redirect-path-after-destroying-a-session-i.e.-signing-out
关于ruby-on-rails - 覆盖设计 after_sign_up_path_for 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8003347/