Ember Data 1.0.0: record.rollback () clears all attributes - what am I doing wrong?

See JSFiddle: http://jsfiddle.net/cyclomarc/HKHEJ/2/

I am converting Ember data from 0.13 to 1.0.0 beta. In previous versions, you could use transaction.rollback () to return any changes made to the model (and not yet saved).

In 1.0.0 you can use record.rollback (). The problem is that all attributes are cleared at this moment ...

cancel: function () { var author = this.get('model'); author.rollback(); }, 

Script in JSFiddle: click on the name, change the text in one of the text fields, then click "Undo Changes". All fields are cleared except for the identifier.

Is this a known issue?

+4
source share
1 answer

Yes, this is a known issue, it was fixed in commit Add rollback support

I updated your jsfiddle to use ember-data-latest and the rollback now works as expected: http://jsfiddle.net/cyclomarc/HKHEJ/2/

  author.rollback(); 
+5
source

Source: https://habr.com/ru/post/1500177/


All Articles