Resolved Issue #122 #123

Closed
wants to merge 1 commit into from
View
2 lib/generators/nested_form/templates/jquery_nested_form.js
@@ -6,7 +6,7 @@ jQuery(function($) {
// Make the context correct by replacing new_<parents> 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]+\]$'), '');
+ 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]