Create a new object instead of updating the current one using SimpleForm simple_fields_for

157 views Asked by At

I have the following nested form in my product_models/new.html.erb

<%= f.simple_fields_for :product_category do |g| %>
    <%= g.input :name, placeholder: "Category name", label: "Category", disabled: true, input_html: {id: "new_product_category_input", style: "width: 300px"} %>
<% end %>

Is there any way I can make the form create the object instead of updating the current one?

Inspecting the generated html, it is possible to see that simple form adds a hidden field with the "id" value of the existing product_category. Removing this field, everything works. But I do not know how to do it =/


product_category
- :id
- :name

0

There are 0 answers