Merge pull request #6713 from acburdine/follow-up-6711

Follow up from #6711
This commit is contained in:
Hannah Wolfe 2016-04-13 19:31:54 +01:00
commit 2e9c8a9421

View File

@ -9,14 +9,15 @@ export default ApplicationSerializer.extend(EmbeddedRecordsMixin, {
tags: {embedded: 'always'}
},
normalizeHash: {
normalize(model, hash, prop) {
// this is to enable us to still access the raw authorId
// without requiring an extra get request (since it is an
// async relationship).
posts(hash) {
if ((prop === 'post' || prop === 'posts') && hash.author !== undefined) {
hash.author_id = hash.author;
return hash;
}
return this._super(...arguments);
},
normalizeSingleResponse(store, primaryModelClass, payload) {