My question is in line with this one: Ember data 1.0.0: confused with per-type adapters and serializers
Problem is that I cannot initialize RESTSerializer per type because I need to set ActiveModelSerializer :
App.FooSerializer = DS.ActiveModelSerializer.extend({attrs: {}});
to set relationships as embedded.
So I want to set 1 serializer for all models. I tried to set ApplicationSerializer
, but this did not call any hooks when getting response from server (And I'm sure my server gives correct response):
App.ApplicationSerializer = DS.RESTSerializer.extend({
extractSingle: function(store, type, payload, id, requestType) {
return this._super(store, type, payload, id, requestType);
},
extractArray: function(store, type, payload, id, requestType) {
return this._super(store, type, payload, id, requestType);
},
normalize: function(type, property, hash) {
return this._super(type, property, hash);
}
});
Setting my adapter doesn't seem to work:
var adapter = require('init/adapter');
App.ApplicationAdapter = adapter.extend({
defaultSerializer: myAdapter //I QUESS THIS IS WRONG?
});
Did I make a syntax error? Any other suggestions?
EDIT:
Ok, I found my mistake but not a great solution. Seems that my FooSerializer overrides the general ApplicationSerializer..
Is there a way where I can set both? :/