我想以這樣的URL來訪問我的檢查站#指數法: http://localhost:3000/lessons/introductions/checkpoints/
導軌路由錯誤?
但我得到這個錯誤:因爲在我的「耙路線」
No route matches {:action=>"show", :controller=>"checkpoints", :lesson_id=>#<Checkpoint id: 1, checkpoint: "Definition of Monetary Policy", url: "http://www.youtube.com/watch?v=HX3wOWN9-sM", objective: "Define monetary policy", description: "Welcome to this series of lectures on monetary poli...", question: "What is the definition of monetary policy?", hint: "It is the deliberate manipulation of something OR s...", answer: "-", lesson_id: 8, created_at: "2012-06-29 07:21:47", updated_at: "2012-06-30 08:24:15", slug: "definition-of-monetary-policy">}
這不應該是這樣的:
lesson_checkpoints GET /lessons/:lesson_id/checkpoints(.:format) checkpoints#index
POST /lessons/:lesson_id/checkpoints(.:format) checkpoints#create
new_lesson_checkpoint GET /lessons/:lesson_id/checkpoints/new(.:format) checkpoints#new
edit_lesson_checkpoint GET /lessons/:lesson_id/checkpoints/:id/edit(.:format) checkpoints#edit
lesson_checkpoint GET /lessons/:lesson_id/checkpoints/:id(.:format) checkpoints#show
PUT /lessons/:lesson_id/checkpoints/:id(.:format) checkpoints#update
DELETE /lessons/:lesson_id/checkpoints/:id(.:format) checkpoints#destroy`
不是加載#index操作而不是#show操作?有誰知道這個錯誤的可能原因?
這是我的routes.rb看起來像:
resources :lessons do
resources :checkpoints
end
resources :lessons
resources :topics do
resources :lessons
end
#Devise Routes
devise_for :users
resources :subjects do
resources :topics
end
聽起來更像是某個視圖中的某個東西試圖鏈接到一個不存在的動作/控制器/參數組合。 –