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

Ensure array passed to preloader has no duplicate records by object_id #39156

Merged
merged 1 commit into from May 5, 2020

Conversation

bogdan
Copy link
Contributor

@bogdan bogdan commented May 5, 2020

Fixes #39073, #39035

Summary

Duplicate records by id are possible for preloader because of joins. However, if duplicate objects equal by object_id are passed, the best fix would be to just remove duplicates.

Other Information

Even though the issue #39073 is only happening for though association, it is better to implement the fix inside AssociationPreloader because in this way it is going to affect direct usage of Preloader class which are no officially documented but very popular anyway.

cc @inkstak @kamipo @alipman88

@inkstak
Copy link

inkstak commented May 5, 2020

Thanks !

@bogdan bogdan force-pushed the preloader-duplicate-object-ids branch from d64e25f to 3d76110 Compare May 5, 2020 17:30
@kamipo kamipo merged commit 42daf01 into rails:master May 5, 2020
kamipo added a commit that referenced this pull request May 5, 2020
Ensure array passed to preloader has no duplicate records by object_id
@bogdan
Copy link
Contributor Author

bogdan commented May 6, 2020

@kamipo will there be a backport?

@bogdan bogdan deleted the preloader-duplicate-object-ids branch May 6, 2020 06:21
@kamipo
Copy link
Member

kamipo commented May 6, 2020

Already done a4b20e4.

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