title: How do you make a rails multi select dropdown work
body: <p>I am trying to make a multi select dropdown work with a dialog for search parameters.  I can make the dropdown multi select but can't seem to get/pass the resulting data. (edited/new info will be in italics)</p>
  
  <p><em>I believe that the root of the problem is that I need to change the permit section in my controller to reflect that I am passing a hash/array.  If I look at the resulting record, the 2 fields that I am setting as multi-selects show as nil. However, if I force an errror, the parameters shown by rails show the correct choices. therefore, I believe that the problem might be with the permit section.</em> </p>
  
  <p><em>That looks like</em> </p>
  
  <pre><code> *def search_params
        params.require(:search).permit(:document_title,
                                       :summary,
                                       :owner,
                                       :category,
                                       :file_name,
                                       :doc_to_email,
                                       :categories_attributes =&gt; [:name])
      end*
  </code></pre>
  
  <p>I added the :categories_attributes => [:name] to try to get the controller to allow hashes but that didn't work. </p>
  
  <p>The select field is </p>
  
  <pre><code> &lt;%= f.select :category[], options_for_select(@categories.sort), {:include_blank =&gt; true}, {:multiple =&gt; true, :size =&gt;10}  %&gt;
  </code></pre>
  
  <p>but that gives me </p>
  
  <blockquote>
    <p>.erb where line #41 raised:</p>
    
    <p>wrong number of arguments (0 for 1..2) Trace of template inclusion:
    app/views/searches/new.html.erb</p>
  </blockquote>
  
  <p>I thought I had to set category as an array with the [] but obviously I'm missing something. </p>
  
  <p>Category is a string field in the Searches table. </p>