Roman L
Roman L

Reputation: 51

Ember error while processing route: You must use Ember.set()

I can't understand what is the reason of this error (EmberJS 2.0):

Error while processing route: articles.index Assertion Failed: You must use Ember.set() to set the `content` property (of <DS.RecordArray:ember379>) to ``. EmberError@https://narayna.zsw.iron/app/js/libs/ember-template-compiler.js:4473:15

My route is looks like:

App.ArticlesRoute = Ember.Route.extend({
  model: function() {
    return this.store.findAll('article').set('content', '');
  }
});

and model like:

App.Article = DS.Model.extend({
  title: DS.attr('string'),
  body: DS.attr('string')
});

App.Article.FIXTURES = [{
  id: 1,
  title: "My article",
  body: "Some text"
}];

Сan anyone help me?

Upvotes: 1

Views: 1053

Answers (2)

Tyler Iguchi
Tyler Iguchi

Reputation: 1074

Not sure why you are setting the content, but the reason you are getting that error is because findAll returns a promise.

model: function() {
    return this.store.findAll('article').then( (article) => {
       article.set('content', '');
       return article;
    });
}

Upvotes: 2

Roman L
Roman L

Reputation: 51

I have not use ember-cli and ember-template-compiller assert looks like error. When I comment out line 1215 of it, all looks better.

Upvotes: 0

Related Questions