Suppose I want to create a Card, and I’ve defined a Discounts relationship that a card has many discounts
Now I create a Card record with a pre-filled Discount in route:
let newCard = this.store.createRecord('card', {
name: 'A new Card',
// ... other attributes
discounts: Ember.A()
})
newCard.get('discounts').addObject(
this.store.createRecord('discount', {
name: 'A new Discount',
// ... other attributes
})
)
Now, in the template & controller, I can manipulate this card and its discounts as expected.
Later, I try to save this card:
this.controller.get('model.card').save()
The request is sent, but then I found the request’s payload is not complete, discounts array is not included in it. But if you use Ember Inspector, you still can see those data with the right relationship with new card.
I try to set a breakpoint before request has been sent, discounts array is not included in the request snapshot, I don’t understand why relationships are excluded from the request payload, how am I suppose to contain these data in the payload?