Permalink
Browse files

Merge pull request #39 from harrigan/what_field_was_added

nested:fieldAdded includes the newly added field
  • Loading branch information...
2 parents c5a2f11 + 05c4d03 commit e9afa7b853c5615b03526107bf68712275698b3a @ryanb ryanb committed May 13, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/generators/nested_form/templates/jquery_nested_form.js
@@ -34,8 +34,8 @@ jQuery(function($) {
var new_id = new Date().getTime();
content = content.replace(regexp, "new_" + new_id);
- $(this).before(content);
- $(this).closest("form").trigger('nested:fieldAdded');
+ var field = $(content).insertBefore(this);
+ $(this).closest("form").trigger({type: 'nested:fieldAdded', field: field});
return false;
});

0 comments on commit e9afa7b

Please sign in to comment.