ryanb/nested_form — pull request #266 by kirel (2013-05-16 13:23:43+00:00)
Title: Fix id generation if parent has no input

If the parent form had no inputs
```javascript
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.