Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Polymorphic relationship #183

@rabc

Description

@rabc

What is the best way to define a polymorphic relationship? I created the models and they are inheriting from the same base class, but then how do I define a ToOne relationship?

I tried using the base class, like (where Group is my base class):

override open class var fields: [Field] {
        return fieldsFromDictionary([
            "group": ToOneRelationship(Group.self)
            ])
    }

But then the deserializer gets the resourceType from the base class, even if I register only the child class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions