title: How to combine collection_check_boxes with additional fields in a "has_may through" form?
body: <p>I have models that look something like this:</p>
  
  <pre><code>class Team
    has_many :users, through: :team_members
  end
  
  class User
    has_many :teams, through: :team_members
  end
  
  class TeamMember
    belongs_to :team
    belongs_to :user
    # with a boolean attribute of :team_captain
  end
  </code></pre>
  
  <p>I am able to select the team members using a <a href="http://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/collection_check_boxes" rel="nofollow">Rails 4 collection of check boxes</a>:</p>
  
  <pre><code>&lt;%= form_for @team do |f| %&gt;
    &lt;%= f.text_field :name %&gt;
    &lt;%= f.collection_check_boxes :users, User.order(:name), :id, :name %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>However, I also need the ability to specify the team captain. I'm sure there's a way to handle this in Rails, but I'm not sure how to do it.</p>