mercredi 1 avril 2015

Rails - select_tag / chechbox tag issue - can't get array of IDs

I've got a list of products in a form that's for another resource that I want to submit. It works without using the label tag, but I want the label tag working.



<%= label_tag "product_ids[#{product.id}]" do %>
<%= check_box_tag "product_ids[#{product.id}]" %>
<%= product.name %>
<% end %>


This produces the following output:



"product_ids"=>{"2"=>"1", "6"=>"1", "3"=>"1"}


Is it possible to just get the array of IDs and not the hash?


Aucun commentaire:

Enregistrer un commentaire