Skip to content

Fix for caching referenced documents belonging to a polymorphic collection #4

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

Merged
merged 3 commits into from
Mar 23, 2012

Conversation

fancyremarker
Copy link
Contributor

cc: @aaw

The cause of this bug is that when we generate cache keys for storing referenced documents, we use the parent document's interpretation of the referenced document's class, which may differ from the referenced document's own interpretation of its class, in the case of polymorphic collections. Thus, when we invalidate the referenced document (by its actual class name), the parent document never catches wind of the invalidation.

Incidentally, this was not a problem for embedded documents, since in the current code we always materialize the embedded document as a full object, rather than just via Mongoid metadata. I wrote a spec for embedded documents anyway.

@dblock
Copy link
Collaborator

dblock commented Mar 21, 2012

Could you please also add a note in HISTORY.md? Thx.

dblock added a commit that referenced this pull request Mar 23, 2012
Fix for caching referenced documents belonging to a polymorphic collection
@dblock dblock merged commit edb7ca2 into mongoid:master Mar 23, 2012
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.

None yet

2 participants