-
Notifications
You must be signed in to change notification settings - Fork 19
Fix problem with eager loading polymorphic associations in mongoid 9 #27
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a problem with eager loading polymorphic associations in Mongoid 9 by addressing object mutation issues when cloning relation metadata. The fix ensures that options are properly duplicated to prevent unintended side effects when handling multiple concrete types in polymorphic relationships.
- Adds defensive copying of options hash when cloning relation metadata for polymorphic associations
- Includes comprehensive test coverage for multiple concrete types and CLI reproduction scenarios
- Addresses issue #22 related to polymorphic association eager loading failures
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/mongoid/includes/inclusion.rb | Adds @options = @options.dup to prevent mutation of shared options hash when cloning metadata |
| spec/mongoid/includes/polymorphic_includes_spec.rb | Adds extensive test coverage for polymorphic eager loading with multiple concrete types and CLI reproduction |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…equires for rbconfig and securerandom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…ding-test-changes Shortened and simplified tests
|
@jclusso I merged your PR. Can't re-request review. |
Fixes #22