Skip to content

Instantly share code, notes, and snippets.

@mikefrey
Created July 9, 2012 15:16
Show Gist options
  • Save mikefrey/3077105 to your computer and use it in GitHub Desktop.
Save mikefrey/3077105 to your computer and use it in GitHub Desktop.
Backbone.js SuperDeepModel
(function() {
function hOPExtend(obj) {
var args = Array.prototype.slice.call(arguments, 1)
for (var i = 0; i < args.length; i++) {
source = args[i]
for (var prop in source) if (source.hasOwnProperty(prop)) {
obj[prop] = source[prop];
}
}
return obj;
}
Backbone.SuperDeepModel = Backbone.DeepModel.extend(hOPExtend({}, Supermodel.Model.prototype), hOPExtend({}, Supermodel.Model))
})()
@mikefrey
Copy link
Author

Updated to fix issues with Supermodel associations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment