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

Count only non-destroyed children to emit the limit reached event #29

Merged
merged 1 commit into from
Aug 28, 2021

Conversation

arielj
Copy link
Owner

@arielj arielj commented Aug 28, 2021

The previous implementation was too basic only using the number of children that the wrapper had to calculate if the accepts_nested_attributes_for limit was reached. It was a problem since it was counting destroyed elements and also any other extra html element that was a direct child of the wrapper.

The new implementation counts the number of [_destroy] hidden fields with value of 0, that's the correct amount.

This closes #8

@arielj arielj merged commit fa68e76 into main Aug 28, 2021
@arielj arielj deleted the fixes/count-fields-and-not-children branch August 28, 2021 23:34
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.

limit uses the wrong count
1 participant