We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 02c5738 commit bce54d4Copy full SHA for bce54d4
1 file changed
lib/generators/nested_form/templates/nested_form.js
@@ -6,7 +6,7 @@ $('form a.add_nested_fields').live('click', function() {
6
7
// Make the context correct by replacing new_<parents> with the generated ID
8
// of each of the parent objects
9
- var context = ($(this).parents('.fields').children('input:first').attr('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
+ var context = ($(this).closest('.fields').find('input:first').attr('name') || '').replace(new RegExp('\[[a-z]+\]$'), '');
10
11
// context will be something like this for a brand new form:
12
// project[tasks_attributes][1255929127459][assignments_attributes][1255929128105]
0 commit comments