Skip to content

Add Support for Deep Models#19

Open
js62789 wants to merge 2 commits into
nytimes:masterfrom
js62789:deepmodel
Open

Add Support for Deep Models#19
js62789 wants to merge 2 commits into
nytimes:masterfrom
js62789:deepmodel

Conversation

@js62789

@js62789 js62789 commented Feb 25, 2015

Copy link
Copy Markdown

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