ember-cli-mirage
ember-cli-mirage copied to clipboard
model.hasInverseFor is not a function
I am getting model.hasInverseFor is not a function and not sure why. Everything else is working fine apart from a polymorphic relationship.
CarModel = Model.extend({
doors: hasMany({ polymorphic: true }),
});
DoorModel = Model.extend({
cars: hasMany('car'),
});
FancyDoorModel = Model.extend({
cars: hasMany('car'),
light: belongsTo('doorLight'),
});
DoorLightModel = Model.extend({
fancyDoors: hasMany('fancyDoor'),
});
I am seeding it using .create with all my own payload for associations. For example...
server.create('car', { doors: [server.create('door'), server.create('fancyDoor')] })
and then I am serialising my own route output
return schema.all('car').models.map(car => {
const { id, doors } = car;
return {
id,
doors: doors.models.map(door => { ... }),
};
})
Is there anyway I can get mirage out of the way of my response object?
Whatever I am returning in the route controller I want as a response, like any other barebones server.