« All deprecation guides

Deprecation Guide for RESTSerializer.normalizeHash

until: 3.0.0
id: restserializer-normalizehash

RESTSerializer.normalizeHash has been deprecated in favor of using normalize.

If you had this:

import DS from 'ember-data';

export default DS.RESTSerializer.extend({
  normalizeHash: {
    _id: function(hash) {
      hash.id = hash._id;
      delete hash._id;
      return hash;
    }
  }
});

You could change it to this:

import DS from 'ember-data';

export default DS.RESTSerializer.extend({
  normalize(model, hash, prop) {
    if (prop === 'comments') {
      hash.id = hash._id;
      delete hash._id;
    }
    return this._super(...arguments);
  }
});