From 73c5f13956bcd49f82aa42f5d924c4084f49093f Mon Sep 17 00:00:00 2001 From: mikzar Date: Fri, 25 Sep 2015 19:55:06 +0200 Subject: [PATCH] Rename 'isDirty' to 'hasDirtyAttributes' Ember Data deprecated `Model.isDirty` in favor of `Model.hasDirtyAttributes`. (https://github.com/emberjs/data/pull/3351) --- .../creating-updating-and-deleting-records.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/models/creating-updating-and-deleting-records.md b/source/models/creating-updating-and-deleting-records.md index 0a132d376..1b49c6c3c 100644 --- a/source/models/creating-updating-and-deleting-records.md +++ b/source/models/creating-updating-and-deleting-records.md @@ -95,18 +95,18 @@ store.findRecord('post', 1).then(function(post) { ``` You can tell if a record has outstanding changes that have not yet been -saved by checking its `isDirty` property. You can also see what parts of +saved by checking its `hasDirtyAttributes` property. You can also see what parts of the record were changed and what the original value was using the `changedAttributes` function. `changedAttributes` returns an object, whose keys are the changed properties and values are an array of values `[oldValue, newValue]`. ```js -person.get('isAdmin'); //=> false -person.get('isDirty'); //=> false +person.get('isAdmin'); //=> false +person.get('hasDirtyAttributes'); //=> false person.set('isAdmin', true); -person.get('isDirty'); //=> true -person.changedAttributes(); //=> { isAdmin: [false, true] } +person.get('hasDirtyAttributes'); //=> true +person.changedAttributes(); //=> { isAdmin: [false, true] } ``` At this point, you can either persist your changes via `save()` or you @@ -114,14 +114,14 @@ can rollback your changes. Calling `rollbackAttributes()` reverts all the `changedAttributes` to their original value. ```js -person.get('isDirty'); //=> true -person.changedAttributes(); //=> { isAdmin: [false, true] } +person.get('hasDirtyAttributes'); //=> true +person.changedAttributes(); //=> { isAdmin: [false, true] } person.rollbackAttributes(); -person.get('isDirty'); //=> false -person.get('isAdmin'); //=> false -person.changedAttributes(); //=> {} +person.get('hasDirtyAttributes'); //=> false +person.get('isAdmin'); //=> false +person.changedAttributes(); //=> {} ``` ## Promises