hasMany on parent page with async true not loading child tabel data

Hi,

These are my models

// employee/model.js
import DS from 'ember-data';

export default DS.Model.extend({
  username: DS.attr('string'),
  password: DS.attr('string'),
  fname: DS.attr('string'),
  lname: DS.attr('string'),
  email: DS.attr('string'),
  created_by: DS.belongsTo('employee', { inverse: null }),
  updated_by: DS.belongsTo('employee', { inverse: null }),
  created_at: DS.attr('date'),
  updated_at: DS.attr('date'),

  address: DS.hasMany('employee/address',  {async: true})
});

// employee/address/model.js
import DS from 'ember-data';

export default DS.Model.extend({
  address: DS.attr('string'),
  phone: DS.attr('string'),
  city: DS.attr('string'),
  country: DS.attr('string'),
  default_address: DS.attr('boolean'),
  employee_id: DS.belongsTo('employee'),
  created_by: DS.attr('number'),
  updated_by: DS.attr('number')
});

This is from my router

this.route('employee', function() {
  this.route('show', {path: '/:employee_id/'});
  this.route('edit', {path: '/:employee_id/edit'});
  this.route('new');
});

If I go to /employee following is my payload

{
  "employees":[
    {
      "id":1,
      "username":"user",
      "password":"user",
      "fname":"Dear",
      "lname":"user",
      "email":"user@samplecom",
      "created_by":null,
      "updated_by":null,
      "created_at":"-0001-11-30 00:00:00",
      "updated_at":"2015-09-08 06:34:43",
      "employee\/addresses":[1, 2]
    },
  ],
    "meta":{
    "total":1,
      "count":1,
      "page":1,
      "per_page":20,
      "current_page":1,
      "lastPage":1
  }
}

Now I clicked on edit, my url is /employee/1/edit I have addresses fields there, and also a button to add more addresses, Ember didnt sent the call to server to load the addresses.

Now I when I reload the page /employee/1/edit from server I have sent the addresses in the payload and that got loaded, my other functions like Add more address, delete address from user and editing a user … all things are working fine.

In my template i am using {{#each model.address key="@index" as |address index|}} to get the associated addresses.

Only problem is when I go from /employee to /employee/1/edit i dont get the addresses associated with the employee 1.

I am using

DEBUG: Ember             : 1.13.7
DEBUG: Ember Data        : 1.13.8

An answer here on this SO Question says that I dont have to do any thing, and the each will make ember fetch these records… which is not working for me

Hmmm, it is resolved. I was sending employee/addresses in the response, instead it should be address only. I am not sure why it was working when I was sending the payload as well. It should be fixed as it is a false positive.