title: How to use build method with a has_many :through association
body: <p><strong>My Models:</strong></p>
  
  <pre><code>class Vip &lt; ActiveRecord::Base
      belongs_to :organization
      has_many :events
      has_many :organizations, :through =&gt; :events
  end
  
  class Organization &lt; ActiveRecord::Base
      belongs_to :user
      has_many :events
      has_many :vips, :through =&gt; :events
  end
  
  class Event &lt; ActiveRecord::Base
    belongs_to :organization
    belongs_to :vip
  end
  </code></pre>
  
  <p><strong>My vips Controller:</strong></p>
  
  <pre><code>def create
      @organization = Organization.find(params[:organization_id])
      @vip = @organization.vips.build(vip_params)
  
      if @vip.save
          redirect_to organization_path(@organization)
      else
          render 'new'
      end
  end
  def vip_params
      params.require(:vip).permit(:name, :about, :organization_id)
  end
  </code></pre>
  
  <p>Before I started using the has_many :through associations, the <code>build</code> method would automatically add the foreign key to the new vip. So my vips table would have the <code>organization_id</code> column populated. Since using the has_many associations, the <code>organization_id</code> column is being left NULL on <code>'vip#create'</code>. </p>
  
  <p>Is there a reason that <code>build</code> wouldn't work the same way anymore with my new associations? </p>