This project is archived and is in readonly mode.
[PATCH] Double loading associations when using preload and an identity map
-
Rizwan Reza
- Tag changed from 3.0pre, activerecord, patch, preload_associations to 3.0pre, activerecord, patch, preload_associations, review
- Assigned user set to Pratik
- Title changed from Double loading associations when using preload and an identity map to [PATCH] Double loading associations when using preload and an identity map
This applies cleanly on master.
-
Pratik
Could you add a failing test please ?
Thanks.
-
Arya Asemanfar
To create a failing test, there would have to be an identity map or the test would have to override AR's instantiate method to shim in identity behavior.
To clarify, this bug is only reproducible with the presence of an AR identity map. I suppose it could remain unfixed until AR natively supports identity map, but it'd be nice to correct the assumption that all or none of the associated records are loaded.
It's possible to create another example to break this assumption. Referring to the example in the original ticket: if the Post model implemented an after_initialize that conditionally loaded comments, but not for the record which will appear first in the author's posts.
What do you think of that as a test?
-
Arya Asemanfar
Here is a patch for a test as described above. It's not the same situation as described in the original ticket, but it does break the same assumption that causes the problem when there is an identity map.
-
rails
- Tag changed from 3.0pre, activerecord, patch, preload_associations, review to 30pre, activerecord, patch, preload_associations, review
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails
- State changed from open to stale
