mercredi 7 février 2018

isDeleted not changed by rollbackAttributes()

I need to be able to "undelete" a record after it has been marked for deletion (not persisted yet). The guides indicate that rollbackAttributes() is the proper way to do this.

However, the following indicates that rollbackAttributes() is not affecting the isDeleted property on the record. I am using Ember 2.15.

console.log(record.get('hasDirtyAttributes')); // false
console.log(record.get('isDeleted')); // false

record.deleteRecord();

console.log(record.get('isDeleted')); // true
console.log(record.get('hasDirtyAttributes')); // false

record.rollbackAttributes();`

console.log(record.get('isDeleted')); // true
console.log(record.get('hasDirtyAttributes')); // false

What's the proper way to have isDeleted align with the actions of rollbackAttributes(), or to "undelete" a record?




Aucun commentaire:

Enregistrer un commentaire