如何在嵌套路线中传递争论?

时间:2015-09-15 07:26:29

标签: ruby-on-rails nested-attributes 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>

1 个答案:

答案 0 :(得分:2)

<% @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 %>

试试这个