Displaying 2 results from an estimated 2 matches for "dem_quantity".
2006 Mar 22
2
What is wrong in this method??????
Hi,
This is my definition of method "add_to_cart"
=======================
def add_to_cart
count=params[:product][:count]
while count.to_i>=0.to_i
if params[:product][''dem_quantity''+count.to_s]==""
else
@product =
Product.find(params[:product][''product_id''+count.to_s])
print @product.name
@product.update_attributes(params[:product][''dem_quantity''+count.to_s])
end
count=count.to_i-1...
2006 Mar 17
1
How to update values in database in this form?
...dden_field ''product'',''product_id''+i.to_s, :value=>product.id%>
<%=product.name%>
</td>
<td>
<%=product.unit_price%>
</td>
<td>
<%=product.quantity%>
</td>
<td>
<%=text_field("product", "dem_quantity"+i.to_s, "size" => 20)%>
</td>
</tr>
<%
i=i+1
%>
<% end%>
<tr>
<%=hidden_field ''product'',''count'', :value=>i.to_i-1%></td>
<td colspan=4 align="center">
<%= submit_tag("Add t...