title: Adding attribute values to a join table record in a has_many :through association upon creation
body: <p>I am setting up a has_many :through relationship on my Rails 3.2 app. I have most everything working, except that I'm not sure how to add values to attributes on the join table when relationships are created. </p>
  
  <p>Here are the models (notice the <strong>source_id</strong> on the <strong>Checkins</strong> table):</p>
  
  <pre><code>create_table "users", :force =&gt; true do |t|
    t.integer  "name"
    t.datetime "created_at", :null =&gt; false
    t.datetime "updated_at", :null =&gt; false
  end
  
  create_table "checkins", :force =&gt; true do |t|
    t.integer  "user_id"
    t.integer  "location_id"
    t.integer  "source_id"
    t.datetime "created_at", :null =&gt; false
    t.datetime "updated_at", :null =&gt; false
  end
  
  create_table "locations", :force =&gt; true do |t|
    t.string   "name"
    t.datetime "created_at", :null =&gt; false
    t.datetime "updated_at", :null =&gt; false
  end
  </code></pre>
  
  <p>Here's the relationship setup:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :checkins
    has_many :locations, :through =&gt; :checkins
  end
  
  class Location &lt; ActiveRecord::Base
    has_many :checkins
    has_many :users, :through =&gt; :checkins
  end
  
  class Checkin &lt; ActiveRecord::Base
    belongs_to :location
    belongs_to :user
  end
  </code></pre>
  
  <p>I'm using these instructions (in essence) to loadi a User and Location and create the relationship with a Checkin:</p>
  
  <pre><code>source_id = 10
  @user = User.first
  @location = Location.first
  @user.locations &lt;&lt; @location
  </code></pre>
  
  <p>So, my question is, how do I also add a <strong>source_id</strong> value to the <strong>Checkins</strong> table when using this line:</p>
  
  <pre><code>@user.locations &lt;&lt; @location
  </code></pre>
  
  <p>I'm also open to suggestions on a better process for creating new User Checkins with this relationship than what I have above (I've seen the <strong>create</strong> and <strong>build</strong> methods used, but none seemed to work for me)</p>