自定义设计路线后,我遇到了一些路由问题。
当前设置(但失败):
- /me/account 加载 Devise::Registration#edit 表单
- /me/account/:什么路由到 account_controller#edit
我的路线(捷径):
devise_for :users do
...
end
devise_scope :user do
scope "/me/account" do
get "/" => "users/registrations#edit", :as => :my_account
get "/:what" => "accounts#edit", :as => :my_account_edit
end
end
resources :accounts, :only => [:edit, :update]
耙路线输出:
activate_account GET /reactivate(.:format) users#reactivate
my_account GET /me/account(.:format) users/registrations#edit
my_account_edit GET /me/account/:what(.:format) accounts#edit
cancel GET /me/account/cancel(.:format) users/registrations#cancel
DELETE /me/account(.:format) users/registrations#destroy
edit_account GET /accounts/:id/edit(.:format) accounts#edit
account PATCH /accounts/:id(.:format) accounts#update
PUT /accounts/:id(.:format) accounts#update
帐户
由于 /me/account 实际上显示了注册#edit ( Devise ) 并且所有 /me/account/helpme 都是自定义表单字段
这有问题:
- /me/account 上没有显示更新或失败的通知
- 失败时,表单不会重新填充先前填写的表单值
- 它没有更新表格
/me/account/helpme 在表单提交时转到 /accounts/1 (当前用户 ID)并抛出错误
没有路由匹配 {:action=>"edit", :controller=>"accounts", :id=>"1", :what=>nil} 缺少必需的键:[:what]
这些问题完全把我逼疯了。任何人都可以向我提供一些建议来解决(一个或多个)这些路由问题吗?