title: collection.build of nested attribute through a remote_link does not create params when submitting form
body: <p>I have the following model:</p>
  
  <pre><code>class Activity &lt; ActiveRecord::Base
    has_many  :clientships, :dependent =&gt; :destroy, :after_add =&gt; :default_client_info
    accepts_nested_attributes_for :clientships, :allow_destroy =&gt; true
  end
  </code></pre>
  
  <p>In my controller, if I perform the following</p>
  
  <pre><code>  def new
      @activity = IndividualActivity.new(params[:activity])
      @activity.clientships.build(:client =&gt; Client.first)
      ...
    end
  </code></pre>
  
  <p>and then save the form, it creates the relevant params and submits successfully.</p>
  
  <p>However, if I chose to call the following through a remote link</p>
  
  <pre><code>@activity.clientships.build(:client =&gt; Client.last)
  </code></pre>
  
  <p><em>the view is updated with the new clientship record but when I submit the form, the params[:activity] is not created for the second nested attribute.</em> <strong><em>(Why not!?)</em></strong></p>
  
  <p>This is the view:</p>
  
  <pre><code>%h1 Create a new Activity
  
  - form_for @activity do |f|
    %div
      = render "activities/client_selector", :f =&gt; f
  
    %div
      = f.submit "Save!"
  </code></pre>
  
  <p>Here is the remote_link's controller action</p>
  
  <pre><code>  def add_client
  
      @activity = IndividualActivity.new(session[:individual_activity])
  
      # Refresh client
      @activity.clientships.build(:client =&gt; Client.find(params[:client_id]))
  
      respond_to do |format|
        format.js
      end
    end
  </code></pre>
  
  <p>This is the add_client.html.js:</p>
  
  <pre><code>page.replace_html "selected_clients", :partial =&gt; 'activities/clients'
  </code></pre>
  
  <p>This is the activities/clients partial:</p>
  
  <pre><code>- form_for @activity do |f|
    - f.fields_for :clientships do |client_f|
      %tr
        %td= client_f.hidden_field :client_id
        %td= client_f.object.client.full_name
  </code></pre>
  
  <p><strong>Does anyone know how I can troubleshoot this further?</strong> I seem to have come to a dead-end with my debugging... One thing to note, there is a double use of the following form_for used in new.html.haml and the activities/clients partial (is this problematic?)</p>
  
  <pre><code>- form_for @activity do |f|
  </code></pre>
  
  <p>I am on rails v2.3.5</p>
  
  <p>Thanks</p>