I use this to loop the products…
<% form_for :product, @products, :url => { :action => "add_to_cart" } do |f| %>
<%= product.title %>
<%= product.price %>
<%= submit_tag 'Make Order' %>
<% end %>
In my DB, I have
product:
title:abc price:874
title:cde price:98
title:efg price:18
but I can only get the efg 18.0 in my result, I miss other records on my result,
any ideas on that?
I suppose that you need an extra form for each product, (based on the
add_to_cartaction).form_forhelper generates a form for one object, so you will need to iterate through your objects and create a form for each one.Something like that is probably what you need: