ruby-on-rails – 覆盖设计after_sign_up_path_for不工作
发布时间:2020-12-16 20:53:31 所属栏目:百科 来源:网络整理
导读:在路由中,我的根路径指向“home #index”,但是当我尝试覆盖它时,after_sign_up_path_for在我登录或注册时会将我重定向到根路径.我试图将它放在设计子类控制器和application_controller中,但它没有用.我需要做什么? 应用控制器 class ApplicationController
在路由中,我的根路径指向“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
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |