with ActiveModelSerializer
usage after the ember-data upgrade, the values of has_many case on the request payload had changed when the model has no records by relation, for example:
// app/models/user.js
import Model from 'ember-data/model';
import { hasMany } from 'ember-data/relationships';
export default Model.extend(Validations, {
posts: hasMany('post'),
...
}
// app/models/post.js
import Model from 'ember-data/model';
import { belongsTo } from 'ember-data/relationships';
export default Model.extend(Validations, {
user: belongsTo('user'),
...
}
so, if User has no posts, previously was sent []
into BE, but after ember-data
bump to 2.14.11 no key-values sent, for example: (request payload)
Before:
user: { id: 1, post_ids: [] }
After:
user: { id: 1 }
Note:
"active-model-adapter": "2.2.0"
"ember-data": "2.14.11"
Aucun commentaire:
Enregistrer un commentaire