jeudi 9 février 2017

Rails habtm checkboxes on create

Is possible to utilize the habtm checkboxes on create action?

because this:

   <%= hidden_field_tag "product[size_ids][]", nil %>
              <% Size.order(:size).each do |size| %>
                <li> <%= check_box_tag "product[size_ids][]", size.id, Product.size_ids.include?(size.id), id: dom_id(size) %>
                <%= label_tag dom_id(size), size.size %>
                </li>
              <% end %>

was on update and was working since was brought to create page rails spits out the

undefined method `size_ids' for #

so, have a way to utilize the habtm on a create action?

Aucun commentaire:

Enregistrer un commentaire