Cast/initialize submodels of a Backbone Model
- by nambrot
I think I have a pretty simple problem that is just pretty difficult to word and therefore hard to find a solution for. Setup:
PathCollection is a Backbone.Collection of Paths
Path is a Backbone.Model which contains NodeCollection (which is a Backbone.Collection) and EdgeCollection (which is a Backbone.Collection).
When I fetch PathCollection
paths = new PathCollection()
paths.fetch()
obviously, Paths get instantiated. However, I'm missing the spot where I can allow a Path to instantiate its submodels from the attribute hashes. I can't really use parse, right? Basically im looking for the entry point for a model when its instantiated and set with attributes. I feel like there must be some convention for it.