travis-web/app/serializers/repo.js
Piotr Sarnacki c3fd0d8e98 Fix loading record by slug
In a repo route we need to find record by slug there is no easy way to
do it with a public finders API, so we need to use adapter and
serializers directly. The problem is that the old way of doing this
didn't use the normalizePayload function and also it didn't add included
records properly. New code properly normalizes response and adds all of
the embedded records that were extracted from the response.
2015-12-08 10:18:06 +01:00

17 lines
432 B
JavaScript

import Ember from 'ember';
import V2FallbackSerializer from 'travis/serializers/v2_fallback';
var Serializer = V2FallbackSerializer.extend({
isNewSerializerAPI: true,
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
if(!id && requestType == 'findRecord') {
id = payload.id;
}
return this._super(store, primaryModelClass, payload, id, requestType);
}
});
export default Serializer;