title: Multiple values for collection_select
body: <p>I am trying to have the following HTML code in my form:</p>
  
  <pre><code> &lt;select name="user[language_ids][]"&gt;
      &lt;option value=""&gt;Please select&lt;/option&gt;
      &lt;option value="1" selected="selected"&gt;English&lt;/option&gt;
      &lt;option value="2"&gt;Spanish&lt;/option&gt;
    &lt;/select&gt;
  
    &lt;select name="user[language_ids][]"&gt;
      &lt;option value=""&gt;Please select&lt;/option&gt;
      &lt;option value="1" selected="selected"&gt;English&lt;/option&gt;
      &lt;option value="2"&gt;Spanish&lt;/option&gt;
    &lt;/select&gt;
  </code></pre>
  
  <p>To allow the User to select two languages when he signs up.  </p>
  
  <p>I have tried with this:</p>
  
  <pre><code>&lt;%= f.label :languages %&gt;
  &lt;%= f.collection_select(:language_ids, Language.all, :id, :name) %&gt;
  &lt;%= f.collection_select(:language_ids, Language.all, :id, :name) %&gt;
  </code></pre>
  
  <p>And also with this:</p>
  
  <pre><code>&lt;%= f.label :languages %&gt;
  &lt;%= f.collection_select(:language_ids[], Language.all, :id, :name) %&gt;
  &lt;%= f.collection_select(:language_ids[], Language.all, :id, :name) %&gt;
  </code></pre>
  
  <p>After revieweing the answers, I have tried with this:</p>
  
  <pre><code>&lt;%= collection_select(:user, :language_ids, Language.all, :id, :name, {}, {:name =&gt; 'user[language_ids][]' }) %&gt;
      &lt;%= collection_select(:user, :language_ids, Language.all, :id, :name, {}, {:name =&gt; 'user[language_ids][]' }) %&gt;
  </code></pre>
  
  <p>But the problem here is that both of the selects have the same ID and also, they are not associated with the form builder <code>f</code></p>
  
  <p>Any thoughts on the best way to do so?</p>