如何在嵌套路由中传递参数?
How to pass arguements in Nested routes?
如何在嵌套路由路径中传递id?我需要发送 picture_id.
<% @histories.pictures.each do |sAV| %>
<td><div class='col-md-4 col-sm-5'> <%=image_tag sAV.pic (:medium) %></td>
<%= link_to 'Delete', history_pictures_path(histories_id: sAV.histories_id, id: pictures.id), class: 'btn btn-danger', method: :delete, data: { confirm: "Are you sure?" } %> </td>
</tr>
<% @histories.pictures.each do |sAV| %>
<td><div class='col-md-4 col-sm-5'> <%=image_tag sAV.pic (:medium) %></td>
<%= link_to 'Delete', history_pictures_path(history_id: sAV.history_id, id: sAV.id), class: 'btn btn-danger', method: :delete, data: { confirm: "Are you sure?" } %> </td>
</tr>
<% end %>
试试这个
如何在嵌套路由路径中传递id?我需要发送 picture_id.
<% @histories.pictures.each do |sAV| %>
<td><div class='col-md-4 col-sm-5'> <%=image_tag sAV.pic (:medium) %></td>
<%= link_to 'Delete', history_pictures_path(histories_id: sAV.histories_id, id: pictures.id), class: 'btn btn-danger', method: :delete, data: { confirm: "Are you sure?" } %> </td>
</tr>
<% @histories.pictures.each do |sAV| %>
<td><div class='col-md-4 col-sm-5'> <%=image_tag sAV.pic (:medium) %></td>
<%= link_to 'Delete', history_pictures_path(history_id: sAV.history_id, id: sAV.id), class: 'btn btn-danger', method: :delete, data: { confirm: "Are you sure?" } %> </td>
</tr>
<% end %>
试试这个