Created
June 16, 2012 23:16
-
-
Save joshvermaire/2942810 to your computer and use it in GitHub Desktop.
multiple collections per model instance
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
tlmodel = (attributes, options) -> | |
attributes = _.extend({}, defaults, attributes) if defaults = getValue(this, "defaults") | |
attributes or = {} | |
options or = {} | |
attributes = @parse(attributes) if options.parse | |
@collections = {} | |
@attributes = {} | |
@_escapedAttributes = {} | |
@cid = _.uniqueId("c") | |
@changed = {} | |
@_silent = {} | |
@_pending = {} | |
collection = options.collection | |
@collections[collection.label] = collection if collection | |
@set attributes, silent: true | |
@changed = {} | |
@_silent = {} | |
@_pending = {} | |
@_previousAttributes = _.clone(@attributes) | |
@initialize.apply this, arguments | |
window.TLModel = Backbone.Model.extend | |
constructor: tlmodel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment