I'm using Loopback 3.2.1 with postgresql connector. I have this polymorphic belongsTo
relation defined in the Question model:
"relations": {
"related": {
"type": "belongsTo",
"model": "questionable",
"polymorphic": true
},
}
But querying on related model gives a 500 error "Relation \"related\" is not defined for Question model"
There seems to be a related issue # 1319 in the github repo that was opened on Apr 21, 2015.
Is there a workaround on this.
I ended up defining the polymorphic relation in the model JavaScript file:
Question.belongsTo('questionable', {
as: 'related',
polymorphic: true
});
This works for me, and gets the related polymorphic relation. Hope this helps others, and the Loopback team resolves this issue soon.