Ember - The content property of DS.PromiseArray should be set before modifying it

The content property of DS.PromiseArray should be set before modifying it

If you see the following error in Ember.Data 1.0.0-beta.7:

The content property of DS.PromiseArray should be set before modifying it

The issue is with changing the contents of an async field.

//program.js
Program = DS.Model.extend({
  styles: DS.hasMany('style', {async: true}),
});

Style = DS.Model.extend({});

and then used like so:

program.get('styles').pushObject(style);

That code will throw the exception listed above. To work around this behavior, do the following:

program.get('styles').then(function(styles){
  styles.pushObject(style);
});

A gist talking about the issue is here.