title: Rails collection_check_boxes
body: <p>I am trying to make use of the <code>collection_check_boxes</code> method.</p>
  
  <p>A <code>group</code>has many <code>users</code>and a user can belong to multiple <code>groups</code>.</p>
  
  <p><code>user.rb</code></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
   has_and_belongs_to_many :groups
  end
  </code></pre>
  
  <p><code>group.rb</code></p>
  
  <pre><code>class Group &lt; ActiveRecord::Base
   has_and_belongs_to_many :users
  end
  </code></pre>
  
  <p><code>groupes.controller.rb</code></p>
  
  <pre><code>class GroupsController &lt; ApplicationController
  
   def new
      @group = Group.new
   end
  end
  </code></pre>
  
  <p><code>new.html.slim</code></p>
  
  <pre><code>h1 Groupes
  
  .hsep
  
  .container-fluid
  
   == form_for @group, { html: { class: 'form-horizontal', remote:true, id: 'new_user' } } do |f|
  
  .form-group
      .col-sm-10
          == f.collection_check_boxes :group, :user_ids, User.all, :id, :login
  
  == f.submit
  </code></pre>
  
  <p>My goal is that when a new <code>group</code>is created, the user can choose which <code>users</code>belong to that group with a checkbox list from all the users.</p>
  
  <p>The error</p>
  
  <pre><code>ActionView::Template::Error (undefined method `merge' for :login:Symbol):
  13: 
  14:     .form-group
  15:         .col-sm-10
  16:             == f.collection_check_boxes :group, :user_ids, User.all, :id, :login
  17: 
  18:     == f.submit
  </code></pre>
  
  <p>I most likely missed something on how to properly use <code>collection_check_boxes</code>but I just can't get around fixing it myself.</p>