Can not operate an asynchronous relationship


#1

Hi, I have 2 model related by a async relationship :

Category

import Ember from 'ember';
import DS from 'ember-data';

/*
*   Category.js
*/
export default DS.Model.extend({
	common : Ember.inject.service('common'),
  	name: DS.attr('string'),
  	position: DS.attr('string'),
  	resources: DS.hasMany('resource', {async :true}),
  	sanitizeName: Ember.computed('name', function() {
    	return this.get('common').sanitize(this.get('name'));
  	}),
  	hasChildren : Ember.computed.sum('resources'),
});

Resource.js

import DS from 'ember-data';

/*
* Resource
*/
export default DS.Model.extend({
  	path: DS.attr('string'),
  	name: DS.attr('string'),
  	keywords: DS.hasMany('keyword'),
  	category: DS.belongsTo('category')
});

When i load both model in the same transition all work fine :

{{#each model as |category|}}
        <section id="{{category.sanitizeName}}">
            {{#if category.hasChildren}}
                    {{#each category.resources as |resource|}}
                        {{{resource.name}}
                    {{/each}}
            {{/if}}
        </section>
    {{/each}}

But if i want to load resources after transition from category/index to category/edit/1, i get a nothing and model.resources return DS.PromiseManyArray:ember663

{{model.resources}} // Return <DS.PromiseManyArray:ember663>

{{#each model.resources as |resource|}} // Display nothing.
	{{resources.name}}
{{/each}}

Route category :

 import Ember from 'ember';
 
export default Ember.Route.extend({
     model: function() {
         return this.store.findAll('category');
     } });

route category/edit

import Ember from ‘ember’;

export default Ember.Route.extend({
	model : function(params) {
		return this.store.findRecord('category', params.category_id);
	}
});

Any idea?