Skip to content

polymorphic has_many associations seem to be broken #366

@jonah-williams

Description

@jonah-williams

When I define a polymorphic has_many association I expect the serializer to produce an array of hashes each of which looks like the output of a polymorphic has_one association. Instead the polymorphic: true option seems to have no effect.

Issue #13 seems to suggest that this should work. However none of the polymorphic tests use has_many and Association::HasMany does not consider the polymorphic option as Association::HasOne does. Am I missing something?

See https://github.com/carbonfive/active_model_serializers/tree/has_many_support_polymorphic_associations for example failing tests.

I'll see if I can provide a fix in a pull request.

cc @AlexMouton

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