在路由中,我的根路径指向“home #index”,但是当我尝试覆盖它时,after_sign_up_path_for在我登录或注册时会将我重定向到根路径.我试图将它放在设计子类控制器和application_controller中,但它没有用.我需要做什么?
应用控制器
- class ApplicationController < ActionController::Base
- protect_from_forgery
- def after_sign_up_path_for(resource)
- show_cities_path(resource)
- end
- end
登记控制员
- class RegistrationsController < ApplicationController
- def after_sign_up_path_for(resource)
- show_cities_path(resource)
- end
- end
路线
- root :to => "home#index"
解决方法
您是否通过执行rake路线检查了show_cities_path是否存在?可能值得一看
https://github.com/plataformatec/devise/wiki/How-To:-Change-the-redirect-path-after-destroying-a-session-i.e.-signing-out