Created
August 21, 2014 17:19
-
-
Save pixelhandler/0b1995704e3fb7147467 to your computer and use it in GitHub Desktop.
function to check if a model is really dirty (Ember Data record, DS.Model)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Strange that model can be dirty with no changed attrs | |
| isReallyDirty = (model) -> | |
| hasChangingAttr = false | |
| attrs = [] | |
| model.eachAttribute (name)-> attrs.push name | |
| for own key, value of model.changedAttributes() | |
| if attrs.contains key | |
| hasChangingAttr = true | |
| break | |
| hasChangingAttr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment