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

Add Support for Deep Models #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

js62789
Copy link

@js62789 js62789 commented Feb 25, 2015

Trackit currently uses underscore's clone method to set original attributes, which is a shallow clone and not a deep clone. As a result, changing nested attributes in a model will also change the attributes in model._originalAttrs. When calling model.unsavedAttributes(), a comparison of the original attributes and current attributes will indicate that there are no unsaved attributes.

This implementation adds a _cloneAttributes method to perform a deep clone on the original attributes for a more accurate comparison when calling unsavedAttributes. Unfortunately, underscore doesn't have a deep clone method and has repeatedly refused implementing one.

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.

1 participant