Rails how can I pass multiple values through check_box_tag?

ruby-on-rails

Solution

please using array dates.

<%= form_tag( { :action => 'create' } ) do %>
    <%  @details.each do |detail| %>
    <%= check_box_tag 'detail[dates][]', detail.date, false, :id => detail.id %>
        <%= detail.date %> 
    <% end %>
    <%= submit_tag 'Register!' %>
<% end %>

Problem

I am trying to pass multiple values to a custom function that I created through the check_box_tag, however I don't really know how to do it, I have check online for hours but didn't help. Basically I have a details view, and I try to pass the date and id information of the detail to the controller and call the create method. ``` <%= form_tag( { :action => 'create' } ) do %> <% @details.each do |detail| %> <%= check_box_tag 'date[]', detail.date, false, :id => detail.id %> <%= detail.date %> <% end %> <%= submit_tag 'Register!' %> <% end %> ``` I try to set the custom value but when I type params in the debugger this is what it shows {"utf8"=>"✓", "authenticity_token"=>"3PKBBKNmXyAfdSllTWBFP8EafhbrJ8rCgOeOp2NbeBA=", "date"=>["2013-06-08"], "commit"=>"Register!", "action"=>"create", "controller"=>"line_items"} I really don't know how should I do it. Thank you for your answer in advance!

Original source