Anyone have any ideas on how to implement this correctly?
I currently have a model with a nested hasMany structure and one of my hasMany relationships is a base model that is being extended to define many different versions of the base model.
ex.
Group = DS.Model.extend({
project: DS.belongsTo('project'),
name: attr(),
requirements: DS.hasMany('requirement', {'async': true})
});
Requirement = DS.Model.extend({
type: attr(),
name: attr(),
group: DS.belongsTo('group')
});
ComputeRequirement = Requirement.extend({
type: attr({default: 'compute_requirement'}),
platform: attr(),
compute: attr(),
memory: attr(),
minInstances: attr()
});
NetworkRequirement = Requirement.extend({
type: attr({default: 'network_requirement'}),
inboundTrxSize: attr(),
inboundTrxRate: attr(),
outboundTrxSize: attr(),
outboundTrxRate: attr()
});
The problem that I seem to be having is that when ember data loads this relationship from the server it is only defining these as requirement models and the only data that i receive is type and name.
Is there a preferred way of doing this? Or is this even supported at all?