title: How to create a rails checkbox within a form using an enum that saves as an array?
body: <p>I'm having trouble figuring this out in my beginning rails journey. There really isn't too much documentation about this so appreciate the help!</p>
  
  <p>I have a model called Documents where I've got the following enum for the :target_industries attribute (:target_industries is a string)</p>
  
  <pre><code>enum target_industries:{
          'Automotive':0,
          'Business Services':1,
          'Construction':2,
          'Consumer Goods':3,
          'Consumer Services':4,
          'Distribution':5,
          'Education':6,
          'Energy &amp; Utilities':7}
  </code></pre>
  
  <p>In my Documents controller I allow that to be an array:</p>
  
  <pre><code>params.require(:documents).permit(:target_industries =&gt; [])
  </code></pre>
  
  <p>I want to reference these values in a rails form for the Documents/new form and save multiple :target_industries as an array. How would I do that? This doesn't save anything but I'm seeing it correctly rendered in the view:</p>
  
  <pre><code>&lt;% Documents.target_industries.each do |key, val| %&gt;
        &lt;%#= form.check_box val %&gt;
        &lt;%= check_box_tag :target_industries, {multiple:true}, val %&gt;
        &lt;%= form.label key %&gt;
      &lt;%end %&gt;
  </code></pre>
  
  <p>Thank you!!!</p>