JsonApi include section not load


#1

I have 2 models Sale and Product Sale: export default DS.Model.extend({ name: DS.attr(‘string’), description: DS.attr(‘string’), published_at: DS.attr(‘number’), products: DS.hasMany(‘product’), mainPage: DS.attr(‘boolean’) });

Product: export default DS.Model.extend({ name: DS.attr(‘string’), brandName: DS.attr(‘string’), brandUrl: DS.attr(‘string’), warehouse: DS.attr(‘string’), instock: DS.attr(‘boolean’), description: DS.attr(‘string’), price: DS.attr(‘number’), count: DS.attr(‘number’), countOrder: DS.attr(‘number’), unit: DS.attr(‘string’), imageUrl: DS.attr(‘string’), });

When I load https://m.rzk.com.ru/s/electricity-gaz-meters-pr this.get(‘store’).findRecord(‘sale’, param.sale_id); The JSON API adapter will send GET requests to Products (product/1, product/2, product/3). Not read from include!!!

But when I load https://m.rzk.com.ru/s Products from include section read.

this.get(‘store’).query(‘sale’, {main_page: true})

Why when use store.query() included data load, but when use store.findRecord() not loaded and Ember send GET requests to products.


#2

Solved! I put ‘included’ section in the ‘data’, the wrong place.