0

I'm having a problem using Ember. When I change a model, its "isDirty" flag becomes true, which is what I expect.

However, after that its "isDirty" flag is true, even after I save that model.

Here's a minimal Rails + Ember project (so I can actually save the model) that shows the situation:

https://github.com/csterritt/etst

Am I doing something wrong? Is this expected behavior?

Thanks!


Edit: Turns out that, as Jeremy Green pointed out below, the "isDirty" flag works for Ember Data.

And, it works with the current Ember 1.0.0 (standard, not -latest) and Ember Data beta.

I was doing:

  isClean: ( ->
    ! @get("isDirty")
  ).property("name", "age", "favorite_food")

Which was due to a misunderstanding on my part. Changing this to:

  isClean: ( ->
    ! @get("isDirty")
  ).property("isDirty")

Works properly.

Unfortunately, this doesn't solve the Epf version's problem. Epf-ites?

chris_st
  • 501
  • 7
  • 19

2 Answers2

0

Can you post a JSBin demonstrating the issue? Here's a simple JSBin with the FixtureAdapter that shows the isDirty flag being cleared correctly.

http://jsbin.com/ucanam/1058/edit

I also just double checked in one of my apps that's using the RESTAdapter against a real API, and it is also clearing the flag.

[EDIT] : The JSBin that I posted is running ember-data-latest, and my real app is using beta 2.

Jeremy Green
  • 8,547
  • 1
  • 29
  • 33
0

With regards to EPF, isDirty is currently a volatile computed property. I will change this soon.

ghempton
  • 7,777
  • 7
  • 48
  • 53