これが他の場所で尋ねられた場合は申し訳ありませんが、私はこれを理解できません。セクション、トピック、返信があるフォーラムがあります。番組のトピック ビューから返信を編集および削除しようとしています。これは構造です:
resources :sections do
resources :topics do
resources :replies
end
end
そこで、rake routes を実行して、編集の返信をリンクしている場所を確認します。その edit_section_topic_reply が表示され、link_to に _path を追加します。今、これは私が理解できないものです。どのパラメータを渡していますか? そうではありませんか:
<%= link_to 'Edit', edit_section_topic_reply_path(@reply, @topic, @section) %>
私ActionController::RoutingError
はTopics#show
これを行うと入ります。
No route matches {:topic_id=>#<Topic id: 2, section_id: 2, user_id: nil, subject: "subject", body: "body", created_at: "2011-03-04 08:37:37", updated_at: "2011-03-04 21:37:16">, :controller=>"replies", :action=>"edit", :section_id=>nil, :id=>#<Section id: 2, name: "Section", description: "Section Description", created_at: "2011-03-04 07:50:56", updated_at: "2011-03-04 07:50:56">}
ID を渡していないようですが、前のネスト、私の新しいトピックは正常に動作します
new_section_topic_reply_path(@topic, @section)