Skip to content

Conversation

@danarnold
Copy link
Member

Fixes #22

Copilot AI review requested due to automatic review settings October 4, 2025 21:07
Copy link
Contributor

Copilot AI left a 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.

@danarnold danarnold requested a review from Copilot October 4, 2025 22:21
Copy link
Contributor

Copilot AI left a 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.

@danarnold danarnold requested a review from jclusso October 4, 2025 22:22
@danarnold
Copy link
Member Author

@jclusso I merged your PR. Can't re-request review.

@danarnold danarnold merged commit 0905ff4 into master Oct 7, 2025
4 checks passed
@danarnold danarnold deleted the polymorphic-assoc-eager-loading branch October 7, 2025 12:52
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.

Problem with eager-loading polymorphic associations on Mongoid 9

3 participants