ember-data-model-fragments
ember-data-model-fragments copied to clipboard
empty fragment array not sent to server
Given
// app/models/person.js
export default Model.extend({
name: attr('string'),
addresses : fragmentArray('address'),
});
// app/models/address.js
export default Fragment.extend({
street : attr('string'),
country : attr('string')
});
If person
looks like -
{
"name": "John",
"addresses": [
{ "street": "test", "country": "test" }
]
}
and I delete the address
object from person
in my app with
this.get('model').get('addresses').removeAt(0)
and try to save the model, the json posted is -
{ "name": "John" }
I would expect the following json to be posted -
{ "name": "John", "addresses": [] }
Is this expected behavior?
ping.
hello @aandis I don't think the behavior has been explicitly defined but I would accept a PR to fix it.