-
Notifications
You must be signed in to change notification settings - Fork 24
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
Unexpected behavior with accepts_nested_attributes_for #68
Comments
I can confirm this is a real issue. |
This just bit us off-guard too. We've added a lot of lazy_preload calls across our multiple projects and this has started getting reported from multiple users. |
I've run into the same issue and it appears the problem is due to the fact that the association.target is being used when detecting records in the nested attributes: `def assign_nested_attributes_for_collection_association(association_name, attributes_collection)
The issue is here:
where the association target is being uses to find if there is an existing record to update. I don't exactly know how to fix it as load_target is overriden by the lazy preloaded and in this case it doesn't detect that it needs to load that association. IMHO this is makes the auto preloading unusable if you use nested attributes. |
was there any specific reason that we call I tried below and it did solved the problem of accepts_nested_attributes_for
|
Hi @DmitryTsepelev,
Could you please help with this case?
P.S. I apologize for the messy code above, but it should show the problem.
The text was updated successfully, but these errors were encountered: