Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Expose per attribute dirty status #814

Closed
tchak opened this Issue · 6 comments

7 participants

@tchak

We have almost all we need to make it happen, just need a public api.

I was thinking of something like :

App.Person = DS.Model.extend({
  name: DS.attr('string'),
 age: DS.attr('number')
});
person.set('name', 'Paul');
person.get('isDirty') // => true
person.('dirty.name') // => true
person.('dirty.age') // => false

I can work on a PR if this is desired

@stefanpenner

unsure about the api, but I think exposing the per record dirty tracking is fantastic. Especially for validations that shouldn't start validating until the attribute is dirty.

@bobbus

This feature would be very useful :+1: I do not see any problem with this API proposal.

@pangratz

Seems like a useful addition :+1:

@igorT
Owner

This is something that is actively being worked on with all the changes to the dirtying, though for now #840 only adds a dirty counter to check how many attributes/relationships are dirty. It might be some time before this works though as there are some fairly large refactors involved.

@tomdale
Owner

@tchak Can you start a thread on Discourse to discuss this API?

@tomdale tomdale closed this
@slindberg

For anyone looking for the solution to this issue, it can be achieved using the DS.Model#changedAttributes method. It's use is also covered in the guide.

Note however that it is not a computed property, so the dirty status of individual attributes cannot be observed as in @tchak's proposal above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.