【发布时间】:2013-10-10 18:36:24
【问题描述】:
自定义设计路线后,我遇到了一些路线问题。
当前设置(但失败):
- /me/account 加载 Devise::Registration#edit form
- /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]
Rake 路由输出:
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]
这些问题完全把我逼疯了。谁能给我一些建议来解决(一个或多个)这些路由问题?
【问题讨论】:
-
对不起,这只是超级混乱。我不知道从哪里开始回答你的问题。
标签: ruby-on-rails-3 devise routes ruby-on-rails-4