title: link_to _remove is working but link_to_add is not working in nested_form RAILS 3
body: <p>I followed <a href="https://github.com/ryanb/nested_form" rel="nofollow">https://github.com/ryanb/nested_form</a></p>
  
  <p>the remove function is working but the add field is not working.</p>
  
  <p>In my model i properly accepted nested attributes. I have division that has many departments.</p>
  
  <p><strong>In division.rb</strong></p>
  
  <pre><code>class Division &lt; ActiveRecord::Base
    attr_accessible :name, :departments_attributes
    has_many :departments, :dependent =&gt; :destroy
    accepts_nested_attributes_for :departments, :reject_if =&gt; lambda { |a| a[:name].blank? }, :allow_destroy =&gt; true
  
  end
  </code></pre>
  
  <p><strong>In department.rb</strong></p>
  
  <pre><code>class Department &lt; ActiveRecord::Base
    attr_accessible :division_id, :name
    belongs_to :division
    belongs_to :user
  end
  </code></pre>
  
  <p>department belongs to division which is right.</p>
  
  <p>In my divisions_controller.rb</p>
  
  <p>my new method works exactly as Ryan B's example: <a href="https://github.com/ryanb/complex-form-examples/tree/nested_form" rel="nofollow">https://github.com/ryanb/complex-form-examples/tree/nested_form</a></p>
  
  <pre><code>def new
      @division = Division.new
      @division.departments.build
    end
  </code></pre>
  
  <p>Plus I require nested_form.js inside my application.js</p>
  
  <pre><code>//= require nested_form
  </code></pre>
  
  <p>nested_form.js:</p>
  
  <pre><code>jQuery(function($) {
    $('form a.add_nested_fields').live('click', function() {
      // Setup
      var assoc   = $(this).attr('data-association');            // Name of child
      var content = $('#' + assoc + '_fields_blueprint').html(); // Fields template
  
      // Make the context correct by replacing new_&lt;parents&gt; with the generated ID
      // of each of the parent objects
      var context = ($(this).closest('.fields').find('input:first').attr('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
  
      // context will be something like this for a brand new form:
      // project[tasks_attributes][new_1255929127459][assignments_attributes][new_1255929128105]
      // or for an edit form:
      // project[tasks_attributes][0][assignments_attributes][1]
      if(context) {
        var parent_names = context.match(/[a-z_]+_attributes/g) || [];
        var parent_ids   = context.match(/(new_)?[0-9]+/g) || [];
  
        for(i = 0; i &lt; parent_names.length; i++) {
          if(parent_ids[i]) {
            content = content.replace(
              new RegExp('(_' + parent_names[i] + ')_.+?_', 'g'),
              '$1_' + parent_ids[i] + '_');
  
            content = content.replace(
              new RegExp('(\\[' + parent_names[i] + '\\])\\[.+?\\]', 'g'),
              '$1[' + parent_ids[i] + ']');
          }
        }
      }
  
      // Make a unique ID for the new child
      var regexp  = new RegExp('new_' + assoc, 'g');
      var new_id  = new Date().getTime();
      content     = content.replace(regexp, "new_" + new_id);
  
      $(this).before(content);
      $(this).closest("form").trigger('nested:fieldAdded');
      return false;
    });
  
    $('form a.remove_nested_fields').live('click', function() {
      var hidden_field = $(this).prev('input[type=hidden]')[0];
      if(hidden_field) {
        hidden_field.value = '1';
      }
      $(this).closest('.fields').hide();
      $(this).closest("form").trigger('nested:fieldRemoved');
      return false;
    });
  });
  </code></pre>
  
  <p>I didn't change something in the nested_form.js because I copied it from the complex sample repo, so that is the default.</p>
  
  <p>Any workaround would be great. Thanks</p>