我试图在用户根据设计文档指南更改密码后更改路径:Customize-the-redirect-after-a-user-edits-their-profile
现在,我知道我必须创建自己的RegistrationController,如
class RegistrationsController < Devise::RegistrationsController
protected
def after_update_path_for(resource)
user_path(resource)
end
end
并将路径更改为
def after_update_path_for(resource)
dashboard_path
end
我用
创建了注册模型rails g controller Registrations
并将其移至app / controllers文件夹
现在它说我还应该配置像
这样的路线devise_for :users, :controllers => { :registrations => :registrations }
由于我只使用资源,所以我并不熟悉写这样的路线,所以我试过
devise_for :users, :controllers => { :registrations => 'dashboard#show' }
给了我错误:
'dashboards#show' is not a supported controller name. This can lead to potential routing problems.
我不太清楚如何正确编写路由以更改dashboard_path的路径。
我是否正确生成控制器?
答案 0 :(得分:1)
您可以使用redirect_to root_path
并在〜/ config / routes.rb中定义根。
您可以通过键入root 'dashboard#show'
(或更常规)root 'dashboard#index'
来定义根路径。