I can't sort out the forms. I'm going along with tutor开发者_StackOverflowial (Agile Web Development with Rails) and I'm trying to simply add the field Quantity to my line_items table. Can't figure this out. Please help. How can I change button_to to pass extra value?
<% if notice %>
<p id="notice" ><%= notice %></p>
<% end %>
<h1>Your Pragmatic Catalog</h1>
<% @products.each do |product| %>
<div class="entry" >
<%= image_tag(product.image_url) %>
<h3><%= product.title %></h3>
<%=sanitize product.description %>
<div class="price_line" >
<span class="price" ></span>
<%= button_to 'Add to Cart', line_items_path(:product_id => product) %>
</div>
</div>
<% end %>
Could you do something like:
<%= button_to 'Add to Cart', { :action => "delete", :id => @image.id, :locals => {:quantity => quantity} } %>
?
精彩评论