Skip to content

Problem with eager-loading polymorphic associations on Mongoid 9 #22

@stanley90

Description

@stanley90

While upgrading Mongoid to 9, I discovered a problem that the relation options got overridden and caused very strange behavior, first reported to Mongoid JIRA.
After investigation, I found out that the problem is in overwriting the relation options here
My temporary patch is to add

@options = @options.dup

to the beginning of that block.

Note: this problem can be reproduced only by invoking the eager-loading before invoking the relation, because there is a memo here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions