title: Rails: Collection_select saving IDs as one entry
body: <p>I am trying to use collection_select instead of select.</p>
  
  <pre><code>&lt;%= form_for(@technol) do |tech| %&gt;
    &lt;div class="field"&gt;
      &lt;%= tech.label :tech %&gt;&lt;br /&gt;
      &lt;%=  tech.select(:tech, Technol.all.map {|p| [p.tech]}.uniq,:prompt =&gt; "Select a previous role") %&gt;
    &lt;/div&gt;
  &lt;%end%&gt;
  </code></pre>
  
  <p>This code works, allowing me to link one technology to a project. I have tried to do this:</p>
  
  <pre><code>&lt;%= form_for(@technol) do |tech| %&gt;
     &lt;div class="field"&gt;
      &lt;%= tech.label :tech %&gt;&lt;br /&gt;
      &lt;%= tech.collection_select(:tech,  Technol.all, :id, :tech, {}, {:multiple =&gt; true} ) %&gt;
    &lt;/div&gt;
  &lt;%end%&gt;
  </code></pre>
  
  <p>The collection_select appears, and all the technologies are shown in the dropdown, and when I pick a few and submit the project, the technologies are shown as one entry, by their IDs. </p>
  
  <p><code>--- - '' - '11' - '12' - '13'</code></p>
  
  <p>Here is my create action, that I think is causing the problem:</p>
  
  <pre><code>def create
      @project = Project.new(params[:project])
      @technol = Technol.new(params[:tech])
  
      params[:technol].each_value do |tech|
  
      technology = Technol.find_or_create_by_tech(tech)
  
      @project_technol = @project.projecttechnols.build(:technol_id =&gt; technology.id) 
  end
  
      respond_to do |format|
        if @project.save
          format.html { redirect_to @project, notice: 'Project was successfully created.' }
          format.json { render json: @project, status: :created, location: @project }
        else
          format.html { render action: "new" }
          format.json { render json: @project.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>I think it's some problem with the way I am looping. Hopefully someone can see it. I am new to rails so please remember this when trying to help me. Thanks in advance.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have tried changing the collection_select to:</p>
  
  <pre><code>&lt;%=  tech.select(:technol, :id, Technol.all.map {|p| [p.tech]}.uniq,:prompt =&gt; "Select a previous role") %&gt;
  </code></pre>
  
  <p>and I get this error. <code>wrong number of arguments (7 for 6)</code></p>
  
  <p>UPDATE for Ross:</p>
  
  <pre><code>wrong number of arguments (7 for 6)
  Extracted source (around line #273):
  
  273: tech.collection_select(:tech, :tech_ids, Technol.all, :id, :tech, {:prompt =&gt; "Select a previous role"}, {:multiple =&gt; true} ) 
  </code></pre>