Add belongsTo ID attribute to payload on create/update

Is there a way to add a models belongsTo id attribute to the payload when creating/updating the model? I am using JSONAPISerializer ATM but can’t find anything on the webs about how to accomplish this. Here’s an example:

Category = DS.Model.extend({});

Thing = DS.Model.extend({
  name: DS.attr(),
  category: DS.belongsTo('category')

// Route
thing = this.get('store').createRecord('thing', {
  name: 'Bananas',
  category: getPreviouslySaved()
});; // category_id is missing from the create payload

Where or how do I add category_id to the payload?

I think you want to separate your create and update actions here. Take a look at the Ember guides here.

Actually, I solved it with this:

export default DS.JSONAPISerializer.extend(DS.EmbeddedRecordsMixin, {

  serialize() {
    const json = this._super(...arguments);
    let atts = Ember.$.extend({},;

    if ('relationships')) {
      for (var key in {
        let relationship =[key];
        if (!Ember.isArray( {
          let name = Ember.String.underscore(`${key}_id`);
          atts[name] =;

    return atts;


Just wanted to the {belongsTo}_id serialized alongside the other attributes.