nested_form
nested_form copied to clipboard
Javascript fails to generate correct html for doubly nested forms
If you have a doubly nested creation form, the javascript will incorrectly strip out the name of the second association and replace it with an integer, breaking the form. Also i think this fixes issue #26.
We can't remove this javascript code because it's here in order to generate correct input names. We even have the test failing with your patch.
Could you please push a test application reproducing this issue? Thanks!
I have the same problem and made a test application for it.
https://github.com/basvanwesting/nested_form_issues_228.git see branch 'free_format'
- commit f7800ed: working example with 3 levels of nesting, so issue the doesn't always occur and is more specific
- commit e026a5: working example in a more complex setup with 2 levels of nesting
- commit 29f5d14: failing example in a more complex setup with 3 levels of nesting
In the test application (branch 'free_format') I found a workaround for the problem:
- commit 1bda69a: change has_one to has_many: solving the failing test of commit 29f5d14
Apparently the problem resides in the has_one relation. Changing this to has_many solves the issue for me. So this issue might be related to #124 and #125.
I applied patch #125 and this solves the issue in commit 29f5d1 for me. The patch no longer applies directly because of some refactoring in nested_form. I'll make a fork and apply the patch in it's new form.
added pull request: https://github.com/ryanb/nested_form/pull/232