mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-03 03:55:26 +03:00
beb409dd5f
closes #2947 - make a PostSerializer to embed the tags objects in the posts POST/PUT request - on editor save, clear out tags from the post and data store that have `id: null`
18 lines
509 B
JavaScript
18 lines
509 B
JavaScript
import ApplicationSerializer from 'ghost/serializers/application';
|
|
|
|
var PostSerializer = ApplicationSerializer.extend({
|
|
serializeHasMany: function (record, json, relationship) {
|
|
var key = relationship.key;
|
|
|
|
if (key === 'tags') {
|
|
json[key] = Ember.get(record, key).map(function (tag) {
|
|
return tag.serialize({ includeId: true });
|
|
});
|
|
} else {
|
|
this._super.apply(this, arguments);
|
|
}
|
|
}
|
|
});
|
|
|
|
export default PostSerializer;
|