我有一个路由错误,但我认为我的路由是正确的:
Routing Error
No route matches {:controller=>"posts", :action=>"edit", :user_id=>#<Post id: 9, title: "Na Curva do Horizonte", content: "Eu na mesma minha opinião no pensamento vejo me ca...", created_at: "2013-01-12 20:41:57", updated_at: "2013-01-12 20:41:57", image_file_name: "iris_by_archang3lzz-d5k2i5l.jpg", image_content_type: "image/jpeg", image_file_size: 1101282, image_updated_at: "2013-01-12 20:41:56", user_id: 5>}
Try running rake routes for more information on available routes.
当我执行rake routes
时,结果是正确的:
user_posts GET /user/:user_id/posts(.:format) posts#index
POST /user/:user_id/posts(.:format) posts#create
new_user_post GET /user/:user_id/posts/new(.:format) posts#new
edit_user_post GET /user/:user_id/posts/:id/edit(.:format) posts#edit
user_post GET /user/:user_id/posts/:id(.:format) posts#show
我的路线是:
resources :posts
resources :user do
resources :posts,:comments
end
resources :posts do
resources :comments
end
错误的链接是:
<%= link_to 'Edit', edit_user_post_path(notice) %>
我不知道出了什么问题。