我有這樣的組織資源:無法刪除屬於另一個資源的資源
resources :tickets do
resources :comments
end
當我嘗試使用這樣的鏈接從一個票(其中,他們都列出)刪除評論:
<table class="table">
<% @ticket.comments.each do |c| %>
</tr>
<td><%= c.text %> | <%= link_to "Delete", ticket_comment_path(c), method: :delete, data: {confirm: "Are you sure?"} %></td>
</tr>
<% end %>
</table>
我有一個錯誤: 無路由匹配{:行動=> 「節目」,:控制器=> 「評論」,:ID => 「5」}缺少必需的鍵:[:TICKET_ID]
我想,f或者ticket_comment_path(c)id應該是評論的ID並且應填寫ticket_id。
但不知何故,我的:id爲一票ID和:TICKET_ID是空的...
嘗試'ticket_comment_path(@ticket,C)' – kddeisz