If I have the following many-to-many relationship
// User
export default DS.Model.create({
name: DS.attr('string'),
authorities: DS.hasMany()
});
// Authority
export default DS.Model.create({
name: DS.attr('string'),
users: DS.hasMany()
});
And I add an authority to a user
user.get('authorities').pushObject(authority);
From the JSONAPI documentation it says to use a POST request to update a hasMany relationship
POST /users/XXX/relationships/authorities
{
"data": [
{ "type": "authorities", "id": "YYY" },
]
}
How can I generate this request via ember-data?
Aucun commentaire:
Enregistrer un commentaire