Skip to content

Instantly share code, notes, and snippets.

@pixelhandler
Created August 21, 2014 17:19
Show Gist options
  • Select an option

  • Save pixelhandler/0b1995704e3fb7147467 to your computer and use it in GitHub Desktop.

Select an option

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)
# 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