Skip to content

Instantly share code, notes, and snippets.

@dnegstad
Created November 21, 2014 00:58
Show Gist options
  • Save dnegstad/f7ed84944849cd9e0e36 to your computer and use it in GitHub Desktop.
Save dnegstad/f7ed84944849cd9e0e36 to your computer and use it in GitHub Desktop.
Read only attributes in Ember Data
import DS from 'ember-data';
DS.ActiveModelSerializer.extend({
serializeAttribute: function(record, json, key, attribute) {
if (attribute.options && attribute.options.readOnly) {
return;
} else {
this._super.apply(this, arguments);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment