I'm trying to create two new related records at once, and I'm wondering the best way to go about this from Ember Data.
I have a User
and a Reminder
. I need to create the user first, then create the user's reminder.
I could write my server code to handle a payload like
reminder: {
text: 'something',
},
user: {
email: 'bob@acme.com'
}
but, how would I get Ember Data to send that payload? Write a custom serializer? On which model, user or reminder?
Alternatively, should I make the two POST requests separately, first the user then the reminder? Is this more idiomatic?
Aucun commentaire:
Enregistrer un commentaire