-
Notifications
You must be signed in to change notification settings - Fork 76
Closed
Description
It appears that the hasMany relationships are not updating when a belongsTo record is created.
The two models i am using are:
export default Model.extend({
name: DS.attr('string', {defaultValue: ""}),
valueCents: DS.attr('number', {defaultValue: 0}),
type: DS.attr('string', {defaultValue: ""}),
discounts: DS.hasMany('discount')
});
and
export default Model.extend({
triggerQuantity: DS.attr('number'),
percentage: DS.attr('number'),
item: DS.belongsTo('item')
});
I am attempting to add a discount to an existing item with the following code:
addDiscount(item){
let discount = item.store.createRecord('discount',{
item: item,
triggerQuantity: 3,
percentage: 3
});
discount.save();
}
According to the ember docs, this should "just work". In the database, I can see that discount record has the id of the item that it was attached to. However the item record just contains an empty array, instead of an array with a reference to the discount record.
I am using:
Ember 2.4.1
ember-data 2.4.0
ember-pouch 3.1.1
Metadata
Metadata
Assignees
Labels
No labels