Created
September 30, 2012 23:42
-
-
Save amundo/3808753 to your computer and use it in GitHub Desktop.
wondering about top-level persistence of a netsted object in backbone
This file contains 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
TextCollection = Backbone.Collection.extend({ | |
model: Text, | |
localStorage: new Backbone.LocalStorage('textCollection') // i only want to persist here | |
}) | |
Text = Backbone.Model.extend({ | |
initialize: function(options){ | |
this.set('sentenceCollection', new SentenceCollection()) | |
} | |
}) | |
Sentence = Backbone.Model.extend({}) | |
SentenceCollection = Backbone.Collection.extend({ | |
model: Sentence, | |
// I don't want a url or localStorage here, I just want to hand it up to the text | |
// should i override Sentence.save? how? | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment