2014-11-06 27 views
0

我的Ember應用程序從API中檢索模型對象,該對象可以包含連續調用中的重複項。如何處理Ember商店中可能的重複項?

我想保存我的對象是這樣的:

myController.store.createRecord('myModel', myModelObject).save() 

不幸的是,當重複發生時,我在控制檯中出現以下錯誤:

Error: Assertion Failed: The id XXX has already been used with another record of type MyApp.MyModel. 
(fonction anonyme)ember.js:3866 

我想不出辦法從錯誤中恢復正常。我試過:

myController.store.createRecord('myModel', myModelObject).save().catch(myFailureCallback) 

但失敗的回調沒有被調用,錯誤是相同的。

回答