A belongsTo child model from parent model using get method is not of DS.Model type

Hi, I am trying to access a related(belongsTo) model from the parent model. the structure is as below

employee= DS.Model.extend({ serialNo: DS.attr(‘number’), name: DS.attr(‘number’), address: DS.belongsTo(‘employee/address’) });

Now in a component i am receiving this top level employee model and there i am trying to access address model as below. this.get(‘employee’).get(‘address’)

but the address object i received is not of Model type, so i am not able to call any Model function on it. Surprisingly this.get(‘employee’) returns a model object and i am able to call any Model function using it.


Sounds like a simular problem I had recently, where I tried to access a relationship but instead got a promise that returned the relationship. So try this:

this.get('employee.address').then((address) => {
  // Do something with address, like...

Please let me know if it helped.