title: Rails field (type hash) and multiple checkboxes
body: <p>I am using Rails (3.2.5 with ruby 1.9.3) and mongodb with mongoid. I'd like to give the user the option to check weekdays. Therefore I have a field with type hash in my controller:</p>
  
  <pre><code>field :wochentage, :type =&gt; Hash, default: {  :mo =&gt; 0,
                                              :di =&gt; 0,
                                              :mi =&gt; 0,
                                              :dn =&gt; 0,
                                              :fr =&gt; 0,
                                              :sa =&gt; 0,
                                              :so =&gt; 0
                                            }
  </code></pre>
  
  <p>The problem is that I cannot get this to work in the web form:</p>
  
  <pre><code>&lt;% for d,v in @timetable.wochentage  %&gt;
      &lt;td&gt;&lt;%= f.check_box :wochentage[d]%&gt;&lt;/td&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The error I get is: </p>
  
  <blockquote>
    <p>can't convert Symbol into Integer</p>
  </blockquote>
  
  <p>Can anyone please point me to the right direction?
  Thanks in advance,
  Sven</p>
  
  <p>OK, a little step further: with the fields_for form helper I got closer:</p>
  
  <pre><code>&lt;%= f.fields_for :wochentage do |w| %&gt;
        &lt;td&gt;&lt;%= w.check_box :mo %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= w.check_box :di %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= w.check_box(:mi, checked_value: "1", unchecked_value: "0") %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= w.check_box :dn %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= w.check_box :fr %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= w.check_box :sa %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= w.check_box :so %&gt;&lt;/td&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>With this code I can set the weekday. But it won't read it from the DB, if I want to edit it though it is stored correctly: <code>Wochentage: {"mo"=&gt;"0", "di"=&gt;"0", "mi"=&gt;"1", "dn"=&gt;"0", "fr"=&gt;"0", "sa"=&gt;"0", "so"=&gt;"0"}</code></p>
  
  <p>In the edit form all checkboxes are unchecked. So how can I make the checkbox show up in the correct status?</p>
  
  <p>Thanks,
  S</p>