I have read and read and obvisouly I am not getting something. Basically
I am wanting to have a check box checked if the value of a database
field is set to 1. Here is my code.
<% for prod_detail in @product.prod_detail %>
Color:<%= prod_detail.color %> Size:<%= prod_detail.size %> Price:<%= prod_detail.price %> Available:
–this is always unchecked even though available is one in the database
<%= check_box (“available”, prod_detail.available) %>
–this actually works.
<input type=“checkbox” name=“available[<%= prod_detail.id %>]”
value="<%= prod_detail.available %>"
<% if prod_detail.available == 1 %> checked=“checked” <% end
So why does one work and the other does not?
Thanks in advance