adopted-ember-addons / adopted-ember-addons/ember-data-model-fragments

empty fragment array not sent to server

Aperta
#323 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
367
Fork
108
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Given
```javascript

// 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 -
```json
{
"name": "John",
"addresses": [
{ "street": "test", "country": "test" }
]
}
```

and I delete the `address` object from `person` in my app with
```javascript
this.get('model').get('addresses').removeAt(0)
```

and try to save the model, the json posted is -

```json
{ "name": "John" }
```

I would expect the following json to be posted -
```json
{ "name": "John", "addresses": [] }
```

Is this expected behavior?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.