I have an attachment
table that contains records that could belong to a lot
or a product
.
Trying to get lot
working first.
// attachment.js
export default Model.extend({
title: attr(),
owner: belongsTo('attachable', {polymorphic: true})
})
// attachable.js
export default Model.extend({
'attachments': hasMany('attachment')
})
import attachable from '../lib/attachable'
// lot.js
export default attachable.extend({
refNumber: attr('string')
})
I get an error thrown when running this.
No model was found for 'attachable'
What is the proper way to set-up such a relationship?