So, I'm trying to sideload records in ember-data. My models are something like:
App.Product = DS.Model.extend({
name: DS.attr('string'),
category_ids: DS.hasMany('App.Category')
});
App.Category = DS.Model.extend({
title: DS.attr('string')
});
I'm configuring the sideload feature as follows:
App.store.adapter.serializer.configure(App.Category,
{
sideloadAs: 'categories'
});
- It works as long the name of my field is "category_ids". Any other name won't work. Is there a way to rename it and keep it working?
- Since the configuration is done in the resource/model, it doesn't seem to have any way to sideload records for categories when loading products and NOT sideloading categories when loading "Posts". In case both use the same Category resource. is that right?