var context = ($(link).closest('.fields').closestChild('input, textarea, select').eq(0).attr('name') || '').replace(/\[[a-z_]+\]$/, '');
would have picked up too much. The subsequent loop would have replaced the [some_attributes][new_assoc]-part with [some_attributes][1] (or whetever id was present).
This pull request works around that case by stripping the context accordingly.
Specs still pass but I haven't added any new ones.
If the parent form had no inputs
would have picked up too much. The subsequent loop would have replaced the
[some_attributes][new_assoc]
-part with[some_attributes][1]
(or whetever id was present).This pull request works around that case by stripping the context accordingly.
Specs still pass but I haven't added any new ones.