title: How to save data with has_many :through
body: <p>I have many-to-many relationship between Game and Account models like below: </p>
  
  <pre><code>class Account &lt; ActiveRecord::Base
    has_many :account_games, :dependent =&gt; :destroy
    has_many :games, :through =&gt; :account_games
  end
  
  class Game &lt; ActiveRecord::Base
    has_many :account_games, :dependent =&gt; :destroy
    has_many :accounts, :through =&gt; :account_games
  end
  
  class AccountGame &lt; ActiveRecord::Base
    belongs_to :account
    belongs_to :game
  end
  </code></pre>
  
  <p>Now I know let's say I want to create a record something like: </p>
  
  <pre><code>@account = Account.new(params[:user])
  @account.games &lt;&lt; Game.first
  @account.save
  </code></pre>
  
  <p>But how am I supposed to update some of the attributes in AccountGame while I'm doing that? Lets say that <code>AccountGame</code> has some field called <code>score</code>, how would I update this attribute? Can you tell me about the best way to do that? To add any field in the through table while I'm saving the object.</p>