我只是想讓鏈接指向「user/1/post/1」。我試過用link_to和不用:方法鍵,並得到了相同的結果。爲什麼這個嵌套資源link_to尋找「摧毀」而不是「show」?
ActionController::RoutingError in Posts#index
Showing /home/test/rails_apps/test_app/app/views/posts/index.html.erb where line #22 raised:
No route matches {:action=>"destroy", :controller=>"posts", :user_id=>#<Post id: 1, content: "wtf", user_id: 1, created_at: "2010-10-27 20:46:46", updated_at: "2010-10-27 20:46:46">}
Extracted source (around line #22):
22: <td><%= link_to 'Show', user_post_path(p), :method => :get %></td>
你可以在第22行發佈更多的上下文嗎? – njorden 2010-10-28 19:58:11