Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Javascript fails to generate correct html for doubly nested forms #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mysrt
Copy link

@Mysrt Mysrt commented Jan 22, 2013

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.

@lest
Copy link
Collaborator

lest commented Jan 23, 2013

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!

@basvanwesting
Copy link

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

@basvanwesting
Copy link

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.

@basvanwesting
Copy link

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.

@basvanwesting
Copy link

added pull request: #232

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants