title: Rails check_box_tag within form_for
body: <p>Is it possible to pass the value of checked <code>check_box_tag</code>s within a <code>form_for</code> in Rails inside a hash?</p>
  
  <p>Here is a very generic, basic version of the form:</p>
  
  <pre><code>&lt;%= form_for(:object, :url =&gt; { :action =&gt; 'create', :id =&gt; params[:id]}) do |f| %&gt;
    &lt;p&gt;Field_a: &lt;%= f.text_field(:field_a) %&gt;&lt;/p&gt;
    &lt;p&gt;Field_b: &lt;%= f.text_field(:field_b) %&gt;&lt;/p&gt;
    &lt;p&gt;Field_c: &lt;%= f.text_field(:field_c) %&gt;&lt;/p&gt;
    &lt;p&gt;Check boxes:&lt;/p&gt;
      &lt;% check_box_choices_object_array.each do |s| %&gt;
        &lt;%= check_box_tag(s.name, 1, false) %&gt;
        &lt;%= .name %&gt;&lt;br /&gt;
      &lt;% end %&gt;
      &lt;%= submit_tag("Create") %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Outputs roughly:</p>
  
  <pre><code>Field_a ___________________
  Field_b ___________________
  Field_c ___________________
  Check boxes:
  [] box_a
  [] box_b
  [] box_c
  [] box_d
  [] box_e
  [] box_f
  [] box_g
  </code></pre>
  
  <p>My problem is that since the available check boxes aren't actual fields in the object's table in the database (i.e. I'm not using <code>check_box(:field)</code> in the form), each checked check box gets passed as an individual parameter (i.e. <code>"box_a" =&gt; "1", "box_b" =&gt; "1", "box_e" =&gt; "1"</code>). I would like them to be passed as such:</p>
  
  <pre><code>:checked_boxes =&gt; {"box_a" =&gt; "1", "box_b" =&gt; "1", "box_e" =&gt; "1"}
  </code></pre>
  
  <p>This way, I can access them easily with <code>params[:checked_boxes]</code>.
  How do I do this, or, better yet, is there a better solution (I'm new to rails)?</p>