The problem is that we are using embedded records in our mongo database and trying to load those same records in our ember.js datastore on the front end. This works fine when we load the document directly but not when we sideload it.
On the ember side we have the corresponding models and the following to support embedded records
App.RateSerializer = App.ApplicationSerializer.extend( DS.EmbeddedRecordsMixin, {
attrs: {
tiers: { embedded: 'always' }
},
});
Now every time we load the rate object directly, the embedded tiers are serialized correctly which is great! Except, to speed up the app we like to sideload the rates.
Now our problem is that when we sideload the object all the embedded objects aren't serialized correctly because ember doesn't call the extractArray
function that the RateSerializer
overrides in the ApplicationSerializer
.
What is the correct way of setting up per-type serializers when sideloading?