title: ActiveRecord :inverse_of does not work on has_many :through on the join model on create
body: <p>I can't get <code>inverse_of</code> to work on join models on creation. I'm not sure if this is a bug or just not implemented as such.  I have the following models:</p>
  
  <pre><code>class Challenge &lt; ActiveRecord::Base
    has_many :groups, :through =&gt; :group_challenges
    has_many :group_challenges, :inverse_of =&gt; :challenge
  
    attr_accessor :contact_ids
  end
  
  class GroupChallenge &lt; ActiveRecord::Base
    belongs_to :challenge, :inverse_of =&gt; :group_challenges
    belongs_to :group, :inverse_of =&gt; :group_challenges
  
    before_save :check_challenge
  
    def check_challenge
      Rails.logger.debug("challenge.contact_ids: #{challenge.contact_ids}")
    end
  end
  
  class Group &lt; ActiveRecord::Base
    has_many :challenges, :through =&gt; :group_challenges
    has_many :group_challenges, :inverse_of =&gt; :group
  end
  </code></pre>
  
  <p><code>contact_ids</code> is a virtual attribute of my <code>challenge</code>, and I'd like to access these in the <code>group_challenges</code> model when that association is created.  I can't get it to work.  Here's an example:</p>
  
  <pre><code>challenge = Challenge.new :groups =&gt; Group.all, :contact_ids =&gt; [1,2,3]
  # log output =&gt; challenge.contact_ids: []
  </code></pre>
  
  <p>However <code>inverse_of</code> does work when the models are reloaded</p>
  
  <pre><code>challenge.reload
  challenge.group_challenges.first.challenge.contact_ids
  # log output =&gt; challenge.contact_ids: [1,2,3]
  </code></pre>
  
  <p>Does anyone know if this is just a design limitation of inverse_of or rather a bug in the implementation?</p>