title: rails submit check box with matching select
body: <p>I have a form that is displaying dates and times like so <a href="https://i.stack.imgur.com/6A6NN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6A6NN.png" alt="enter image description here"></a></p>
  
  <p>The code for it looks like this:</p>
  
  <pre><code> &lt;%= f.fields_for :availabilities do |ff| %&gt;
  &lt;% ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].each do |day| %&gt;
      &lt;div class="row"&gt;
        &lt;div class="col-md-4"&gt;
          &lt;div class="ck-button"&gt;
            &lt;label&gt;
              &lt;%= ff.check_box "day", {multiple: true, checked: @therapist.available_times.key?(day)}, day, false %&gt;
              &lt;span&gt;&lt;%= day %&gt;&lt;/span&gt;
            &lt;/label&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="col-md-4"&gt;
          &lt;div class="answer"&gt;
            &lt;%= ff.select "start_time", ["1 AM", "2 AM", "3 AM", "4 AM", "5 AM", "6 AM", "7 AM", "8 AM", "9 AM", "10 AM", "11 AM", "12 PM", "1 PM", "2 PM", "3 PM", "4 PM", "5 PM", "6 PM", "7 PM", "8 PM", "9 PM", "10 PM", "11 PM"], {:selected =&gt; (@therapist.available_times.key?(day) ? @therapist.available_times[day][:start] : '7' )} %&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="col-md-4"&gt;
          &lt;div class="answer"&gt;
            &lt;%= ff.select "end_time", ["1 AM", "2 AM", "3 AM", "4 AM", "5 AM", "6 AM", "7 AM", "8 AM", "9 AM", "10 AM", "11 AM", "12 PM", "1 PM", "2 PM", "3 PM", "4 PM", "5 PM", "6 PM", "7 PM", "8 PM", "9 PM", "10 PM", "11 PM"], {:selected =&gt; (@therapist.available_times.key?(day) ? @therapist.available_times[day][:end] : '17' )} %&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p>When I submit this however, the data sent to my controller looks like this:</p>
  
  <pre><code>"availabilities"=&gt;{"start_time"=&gt;"1 AM", "end_time"=&gt;"1 AM", "day"=&gt;["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]}
  </code></pre>
  
  <p>What I really want is to get:</p>
  
  <pre><code>"availabilities"=&gt;[{"start_time"=&gt; "1 AM", "end_time"=&gt;"1 AM", "day" =&gt; "Monday"},{"start_time"=&gt; ...},...]
  </code></pre>
  
  <p>only for the days that are selected.</p>
  
  <p>From the controller side, I have the permit looking as:</p>
  
  <pre><code>:availabilities =&gt; [:day, :start_time, :end_time],
  </code></pre>
  
  <p>EDIT:
  I changed the <code>multiple</code> to <code>false</code> and now my availabilities has the form I want but I only get the last checked, not an array of all the checked fields and their associated times</p>