Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dirty checking and only PATCHing modified fields #9

Merged
merged 5 commits into from Mar 6, 2014
Merged

Implement dirty checking and only PATCHing modified fields #9

merged 5 commits into from Mar 6, 2014

Conversation

wms
Copy link
Collaborator

@wms wms commented Jan 19, 2014

Implements the following instance methods and properties:

  • $original - cached state when initially retrieved from data source
  • $dirty() - returns a boolean, true if instance has modified fields
  • $pristine() - returns a boolean, true if instance has no modified fields
  • $modified() - returns an object listing fields that have been modified with their new values
  • $revert() - resets current state to $original

PATCH payloads now only contain modified fields. On a successful PATCH, $original is updated to the new state, making the instance $pristine() again. POSTs of new instances are unaffected.

Todo:

@nateabele
Copy link
Member

Hm, there's no way to hide $original inside a closure?

@nateabele nateabele merged commit bab869f into radify:master Mar 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants