3

我在 ObjectController 中有以下内容,并验证了这两个操作都被正确调用:

setup: ->
  transaction = @get('store').transaction()
  post = transaction.createRecord(App.Post, {postedAt: new Date()})
  @set('content', post)

cancel: ->
  @get('content.transaction').rollback()

然而,尽管事务被回滚,但未提交的记录仍然存在于数据存储中。

我应该在交易中以不同的方式处理创建的记录吗?

编辑:回滚交易后,我也看到了这样的错误:

Error: Attempted to handle event `didSetProperty` on <App.Post:ember926:null> while in state rootState.deleted.saved. Called with {name: title}
4

0 回答 0