Update Objects and reset the isDirty-flag (ember-data 1.0 beta.2)

[ I see this is the wrong forum, sorry - moved to ember.js - Update Objects and reset the isDirty-flag (ember-data 1.0 beta.2) - Stack Overflow ]

With former versions of ember-data I could bring a modified model back to clear-state by calling:

user.transitionTo(‘loaded.saved’)

Is there a way to do this in version 1.0beta.2? The main reason is to suppress any server requests when saying

user.save()

What about user.rollback()?

Taking the look at the source code it does exactly what you try to achieve.

@balint: thanks for the hint - u.rollback() actually reverts the changes too, but clearing the _attributes before transition

u.get('isDirty') => true

u._attributes = {}
u.transitionTo('loaded.saved')

u.get('isDirty') => false

seems to work pretty well.

So do I understand correctly that rollback() does not cut it for you because it also clears out the _attributes hash?

Not exactly - I’ll give an example of what I meant. But while I typed it I found out that this not a good solution, because by clearing out the _attributes, the object loses its ability to become dirty again permanently (ember-data 1.0 beta2).

setup:
u = App.store.all('user').objectAt(1)
u.get('isOnline') => false
u.get('isDirty') => false

u.set('isOnline', true)
u.get('isDirty') => true
u._attributes => Object {isOnline: true}

a) with rollback:
u.rollback()
u.get('isDirty') => false
u.get('isOnline') => false

b) with clear _attributes & transition:
u._attributes = {}
u.transitionTo('loaded.saved')
u.get('isDirty') => false
u.get('isOnline') => true

ahh, this url Ember Data 1.0.0 Beta 2 Released has a solution:

"Add store.update(type, hash) to update some, but not all attributes"

That’s not really an answer to my former question - but it is exactly what I want.