title: accepts_nested_attributes_for with has_many => :through Options
body: <p>I have two models, links and tags, associated through a third, link_tags.  The following code is in my Link model.</p>
  
  <p>Associations:</p>
  
  <pre><code>class Link &lt; ActiveRecord::Base
    has_many :tags, :through =&gt; :link_tags
    has_many :link_tags
  
    accepts_nested_attributes_for :tags, :allow_destroy =&gt; :false, 
    :reject_if =&gt; proc { |attrs| attrs.all? { |k, v| v.blank? } }
  end
  
  class Tag &lt; ActiveRecord::Base
    has_many :links, :through =&gt; :link_tags
    has_many :link_tags
  end
  
  class LinkTag &lt; ActiveRecord::Base
    belongs_to :link
    belongs_to :tag
  end
  </code></pre>
  
  <p>links_controller Actions:</p>
  
  <pre><code>  def new
      @link = @current_user.links.build
      respond_to do |format|
        format.html # new.html.erb
        format.xml  { render :xml =&gt; @link }
      end
    end
  
    def create
      @link = @current_user.links.build(params[:link])
  
      respond_to do |format|
        if @link.save
          flash[:notice] = 'Link was successfully created.'
          format.html { redirect_to links_path }
          format.xml  { render :xml =&gt; @link, :status =&gt; :created, :location =&gt; @link }
        else
          format.html { render :action =&gt; "new" }
          format.xml  { render :xml =&gt; @link.errors, :status =&gt; :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>View code from new.html.erb:</p>
  
  <pre><code>&lt;% form_for [current_user, @link], :url =&gt; account_links_path do |f| %&gt;
  &lt;%= render :partial =&gt; "form", :locals =&gt; { :f =&gt; f } %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>And the corresponding partial:</p>
  
  <pre><code>  &lt;%= f.error_messages %&gt;
  
    &lt;p&gt;
      &lt;%= f.label :uri %&gt;&lt;br /&gt;
      &lt;%= f.text_field :uri %&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;%= f.label :title %&gt;&lt;br /&gt;
      &lt;%= f.text_field :title %&gt;
    &lt;/p&gt;
  
    &lt;h2&gt;Tags&lt;/h2&gt;
    &lt;% f.fields_for :tags_attributes do |tag_form| %&gt;
    &lt;p&gt;
      &lt;%= tag_form.label :name, 'Tag:' %&gt;
      &lt;%= tag_form.text_field :name %&gt;
    &lt;/p&gt;
    &lt;% unless tag_form.object.nil? || tag_form.object.new_record? %&gt;
    &lt;p&gt;
      &lt;%= tag_form.label :_delete, 'Remove:' %&gt;
      &lt;%= tag_form.check_box :_delete %&gt;
    &lt;/p&gt;
    &lt;% end %&gt;
    &lt;% end %&gt;
  
    &lt;p&gt;
      &lt;%= f.submit 'Update' %&gt;
    &lt;/p&gt;
  </code></pre>
  
  <p>The following line of code, in the create action in the Link controller throws an error:</p>
  
  <pre><code>@link = @current_user.links.build(params[:link])
  </code></pre>
  
  <p>The error: <code>Tag(#-621698598) expected, got Array(#-609734898)</code></p>
  
  <p>Are there additional steps needed in the has_many => :through case?  These seem to be the only indicated changes for the basic has_many case.</p>