abuiles / ember-cli-101-errata

18 stars 4 forks source link

Page 112: code snippet differs from what it is on a previous page #185

Closed kbjorklid closed 9 years ago

kbjorklid commented 9 years ago

On page 112 of the newest version's PDF there is a code snippet with the following content:

stateChanged: function() {
    if (this.get('model.isDirty') && !this.get('model.isSaving')) {
        Ember.run.once(this, this.autoSave);
    }
}.on('init').observes('model.state)

I believe this should be a copy of how that function was previously written, but it is considerably different from its previous form, on page 74:

stateChanged: function() {
    var article = this.get('article');
    if (article.get('isDirty') && !article.get('isSaving')) {
        Ember.run.once(this, this.autoSave);
    }
}.on('init').observes('article.state')
abuiles commented 9 years ago

@kbjorklid thanks! this was a mistake on my end, the code should be

var article = this.get('article');
    if (article.get('isDirty') && !article.get('isSaving')) {
        Ember.run.once(this, this.autoSave);
    }

This will be fixed in the next release :)