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

Polymorphic relationship #183

Open
rabc opened this issue May 11, 2017 · 1 comment
Open

Polymorphic relationship #183

rabc opened this issue May 11, 2017 · 1 comment

Comments

@rabc
Copy link

rabc commented May 11, 2017

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.

@markst
Copy link

markst commented May 22, 2017

@rabc should be achievable using branch on this PR: #154

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants