Skip to content

Instantly share code, notes, and snippets.

@wecc
Created November 26, 2014 20:17
Show Gist options
  • Select an option

  • Save wecc/3d30c73b5bec4fe3d708 to your computer and use it in GitHub Desktop.

Select an option

Save wecc/3d30c73b5bec4fe3d708 to your computer and use it in GitHub Desktop.
Use this method to restore the old Ember Data behavior where properties with missing keys in the payload gets cleared.
App.ApplicationSerializer = DS.RESTSerializer.extend({
normalizeAttributes: function(type, hash) {
this._super(type, hash);
type.eachAttribute(function(key) {
if (!hash.hasOwnProperty(key)) {
hash[key] = null;
}
}, this);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment