title: Rails nested form with has_many :through, how to edit attributes of join model?
body: <p>How do you edit the attributes of a join model when using accepts_nested_attributes_for?</p>
  
  <p>I have 3 models: Topics and Articles joined by Linkers</p>
  
  <pre><code>class Topic &lt; ActiveRecord::Base
    has_many :linkers
    has_many :articles, :through =&gt; :linkers, :foreign_key =&gt; :article_id
    accepts_nested_attributes_for :articles
  end
  class Article &lt; ActiveRecord::Base
    has_many :linkers
    has_many :topics, :through =&gt; :linkers, :foreign_key =&gt; :topic_id
  end
  class Linker &lt; ActiveRecord::Base
    #this is the join model, has extra attributes like "relevance"
    belongs_to :topic
    belongs_to :article
  end
  </code></pre>
  
  <p>So when I build the article in the "new" action of the topics controller...</p>
  
  <pre><code>@topic.articles.build
  </code></pre>
  
  <p>...and make the nested form in topics/new.html.erb...</p>
  
  <pre><code>&lt;% form_for(@topic) do |topic_form| %&gt;
    ...fields...
    &lt;% topic_form.fields_for :articles do |article_form| %&gt;
      ...fields...
  </code></pre>
  
  <p>...Rails automatically creates the linker, which is great.
  <strong><em>Now for my question:</em></strong> My Linker model also has attributes that I want to be able to change via the "new topic" form. But the linker that Rails automatically creates has nil values for all its attributes except topic_id and article_id. How can I put fields for those other linker attributes into the "new topic" form so they don't come out nil?</p>