我有路線問題...未初始化的常數控制器
的routes.rb
resources :documents do
resources :user do
delete 'user_unassign'
end
resources :attachments do
collection do
get :index_parent_attachments
end
end
end
resources :document_types do
resources :documents
end
devise_scope :user do
# root :to => "devise/sessions#new" #, :as => :root
end
devise_for :users
namespace :admin do
resources :users, :document_types
end
當我點擊此鏈接:
<%= link_to 'unfollow', document_user_user_unassign_path(document, user.id), :method => 'delete' %>
它遵循這條路線本地主機:3000/documents/1/user/2/user_unassign,我得到一個錯誤:未初始化的常量UserController
條路線
Prefix Verb URI Pattern Controller#Action
root GET / profiles#dashboard
user_root GET /profiles/dashboard(.:format) profiles#dashboard
document_user_user_unassign DELETE /documents/:document_id/user/:user_id/user_unassign(.:format) user#user_unassign
document_user_index GET /documents/:document_id/user(.:format) user#index
POST /documents/:document_id/user(.:format) user#create
new_document_user GET /documents/:document_id/user/new(.:format) user#new
edit_document_user GET /documents/:document_id/user/:id/edit(.:format) user#edit
document_user GET /documents/:document_id/user/:id(.:format) user#show
PATCH /documents/:document_id/user/:id(.:format) user#update
PUT /documents/:document_id/user/:id(.:format) user#update
DELETE /documents/:document_id/user/:id(.:format) user#destroy
index_parent_attachments_document_attachments GET /documents/:document_id/attachments/index_parent_attachments(.:format) attachments#index_parent_attachments
document_attachments GET /documents/:document_id
我不認爲你的定義路徑是正確的。 – Severin
document_user_user_unassign DELETE /documents/:document_id/user/:user_id/user_unassign(.:format)user#user_unassign – user3461461
用戶控制器的名稱是什麼? –