Do not include url and author_id in post payload.

No Issue.
- Neither of these properties should be included in the
  payload sent from the client to the API.  URL is a
  read-only virtual property, and author_id is inserted
  locally as a convenience.
This commit is contained in:
Jason Williams 2014-12-15 15:01:30 +00:00
parent 5ac4bf1c3c
commit 496e92a515

View File

@ -52,10 +52,14 @@ var PostSerializer = ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
var root = Ember.String.pluralize(type.typeKey), var root = Ember.String.pluralize(type.typeKey),
data = this.serialize(record, options); data = this.serialize(record, options);
// Don't ever pass uuid's // Properties that exist on the model but we don't want sent in the payload
delete data.uuid; delete data.uuid;
// Don't send HTML
delete data.html; delete data.html;
// Inserted locally as a convenience.
delete data.author_id;
// Read-only virtual property.
delete data.url;
hash[root] = [data]; hash[root] = [data];
} }