Maybe the question is simple for you.
I use the Bidon and Buy models, which are related, when I show the detail of the drum suppose with ID: 1, in the I am showing the last purchases that are made with that drum, what I can not get is that when I select a different drum, it shows me the purchases made with that drum and not the last ones only.
this is the (views / bidons / show.html.erb)
<% @compras.each do |compra| %>
<ul>
<li>
<small>Cantidad utilizada:</small> <span class="badge badge-inverse">
<small><%= compra.cantidad_comprada %></small></span> | <small>Producto:</small>
<span class="badge badge-purple"><small><%= compra.product %></small></span>
<%= link_to '<i class="fa fa-eye">
</i>
<span class="sr-only">Detalles</span>'.html_safe, compra_path(compra), :title => "Mostrar detalles", :class => "green bigger-140 show-details-btn" %>
</li>
</ul>
<% end %>
How can I show only the purchases made with a specific drum?
Try to buy the corresponding ids: @ bidon.id and @ compra.bidon_id, if these two are equal, the result would be true in the show.html.erb, but I think I'm missing something.
I appreciate your time and understanding.
Mosiah.