I took over an app written in Ember, which is fairly new to me. Also, I learned Ember Octane, but the app is using Ember 3.2. It also uses Ember Data with the default JSONAPISerializer.
In my app there's a project
model, and each model belongs to a creator
, which is an instance of a person
:
In models/projects.js
:
creator: DS.belongsTo('person', { inverse: null }),
I want to update this relationship data (assign a new creator
to the project
) in a controller method:
project.set('creator', otherPerson); // or project.creator_id = otherPerson.id;
project.save();
The POST request is successful, but there isn't any relationship data in the payload, hence the creator isn't updated.
What's wrong here?
Aucun commentaire:
Enregistrer un commentaire