I’ve been using simple_form for rails together with HAML
I have a number of line_items they have a unique id which i retrieve from the Order object
= f.simple_fields_for :line_items do |line_items|
.f.input :id unless @order.status?
.f.input :cost unless @order.status?
However, whenever i iterate through these list, i would like to hide (remove from the form) the line_items id, i try to put a unless statement to remove other parameters and it works (eg. :cost) but for the :id it appears to be a hidden fields
<input id="order_line_items_attributes_2_id" name="order[line_items_attributes][2][id]" type="hidden" value="26">
How can i successfully remove IDs from appearing in the fields just like how i did it for :cost?
try this:
= f.simple_fields_for :line_items, include_id: false do |line_items|more on this: http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for