路由錯誤時路由錯誤瀏覽一個實例
No route matches {:action=>"edit", :controller=>"statuses", :id=>nil}
When http://0.0.0.0:3000/users/2
不明白爲什麼它說:控制器=> 「狀態」當我的路由文件說:
Treebook::Application.routes.draw do
get "users/show"
resources :credits
resources :merchants
devise_for :users
resources :statuses
root to: 'statuses#index'
get 'users/:id', to: 'users#show'
耙路線
root / statuses#index
credits GET /credits(.:format) credits#index
POST /credits(.:format) credits#create
new_credit GET /credits/new(.:format) credits#new
edit_credit GET /credits/:id/edit(.:format) credits#edit
credit GET /credits/:id(.:format) credits#show
PUT /credits/:id(.:format) credits#update
DELETE /credits/:id(.:format) credits#destroy
merchants GET /merchants(.:format) merchants#index
POST /merchants(.:format) merchants#create
new_merchant GET /merchants/new(.:format) merchants#new
edit_merchant GET /merchants/:id/edit(.:format) merchants#edit
merchant GET /merchants/:id(.:format) merchants#show
PUT /merchants/:id(.:format) merchants#update
DELETE /merchants/:id(.:format) merchants#destroy
statuses GET /statuses(.:format) statuses#index
POST /statuses(.:format) statuses#create
new_status GET /statuses/new(.:format) statuses#new
edit_status GET /statuses/:id/edit(.:format) statuses#edit
status GET /statuses/:id(.:format) statuses#show
PUT /statuses/:id(.:format) statuses#update
DELETE /statuses/:id(.:format) statuses#destroy
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_us er_registration GET /users/cancel(.:format)devise/registrations#cancel user_registration POST /users(.:format)devise/registrations#create new_user_registration GET /users/sign_up(.:format)devise/registrations#new edit_user_registration GET /users/edit(.:format)devise/registrations#edit PUT /users(.:format)devise/registrations#update DELETE /users(.:format)devise/registrations#destroy user GET/users /: (:格式)ID用戶#顯示
粘貼您的整個路線文件和耙路線的輸出。這看起來不正確,你在那裏。 – rainkinz
也在控制檯上做到這一點:耙路線 – khelll
我會嘗試擺脫獲得「用戶/表演」的方式。這對我來說並不合適。 – rainkinz