0

我正在尝试使用像这样(jsBin)的 ember-data 更新我的模型:

App = Ember.Application.create({
  ready: function() {
    var post = App.Post.find(1);
    post.one('didLoad', function() {
      post.set('name', 'my new name');
      post.save();
    });
  }
});

App.Store = DS.Store.extend({
  revision: 12,
  adapter: DS.FixtureAdapter
});

App.Post = DS.Model.extend({
  name: DS.attr('string')
});

App.Post.FIXTURES = [
  {id: '1', name: 'first post'}
];

我在 Chrome 中收到以下错误:

Uncaught Error: Attempted to handle event `didCommit` on <App.Post:ember226:1> while in state rootState.loaded.updated.uncommitted. Called with undefined

有什么问题还是这是一个错误?

4

0 回答 0