I have quantity and quantity_received in a table. I want to populate quantity_received with quantity value however if I overwrite this value next time I load the form I want to display the saved value.
<%= fields_for "purchase_item[]", purchase_item do |f| %>
<td><%= f.number_field :quantity_received, :min => 1, :value => purchase_item.quantity, :size => 8 %></td>
<% end %>
Does RoR have some built-in function for that?
Seems like the easiest way would be to set it when you store the original
quantityfield to avoid having to set it in the form.What’s wrong with the way you’re doing it now?