Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 3 level nesting #77

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Support 3 level nesting #77

wants to merge 3 commits into from

Conversation

arielj
Copy link
Owner

@arielj arielj commented Dec 7, 2023

This PR adds support for creating a form with 3 levels: the parent form, dynamic children, and dynamic grandchildren.

This requires a new convention to work properly since it's simple to detect when we nave this extra nesting to do it automatically.

  • If more than one nesting is used, the new idx_placeholder option must be defined by the user of the gem and each level must have a different value
  • The wrapper ids for a nested element must include the parent's id and idx_placeholder value

The test app includes an example of these conventions:

https://github.com/arielj/vanilla-nested/blob/support-3-level-nesting/test/VanillaNestedTestRails7/app/views/users/_form.html.erb#L5

https://github.com/arielj/vanilla-nested/blob/support-3-level-nesting/test/VanillaNestedTestRails7/app/views/users/_pet_fields.html.erb#L12-L17

@agirlnamedsophia
Copy link

this doesn't work for me, but i imagine I'm doing something wrong? i keep getting the error
ActionView::Template::Error (undefined local variable or method f' for #ActionView::Base:0x0000000002c600` even when literally copy and pasting your examples but with swapped out model names.

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

Successfully merging this pull request may close these issues.

2 participants