Many to Many relation linking\fetching problem


#1

I have two models in Ember: field-type, field-option, defined as follows:

import DS from ‘ember-data’;
export default DS.Model.extend({

fieldTypes: DS.hasMany(‘fieldType’)
});

import DS from ‘ember-data’;
export default DS.Model.extend({

leadFields: DS.hasMany(‘leadField’), //probably ignore this line, connection to the other model. fieldOptions: DS.hasMany(‘fieldOption’)
});

Then I fetch fieldType object in component’s init:
init() {

let a = this.get(‘store’).findRecord(‘fieldType’,1); //this goes ok
this.set(‘a’, a);

Then try to fetch fieldOptions in a computed value in this component
let val = this.get(‘a’); //no problem here
val.get(‘fieldOptions’); //Object, of an empty array
But it returns result of length=0, it actually doesn’t even send a request to backend, what I believe is the main issue. What am I doing wrong here?

Backend is looback3, fieldType and fieldOptions are connected via hasManyThrough relationship (have intermediate model). Looback explorer presents GET /field-types/{id}/fieldOption which works as it expected, so the data in the DB is set properly, but the thing is Ember doesn’t send the request.