How to "extract" nested models and collections using backbone.js

I have a model with two nested collections. What is the best way to automatically fetch these collections when fetching the parent model?

+4
source share
1 answer

In Rails, you can include dependent objects in your JSON. I donโ€™t know the backend you use, but that would save you on two trips:

{ att1: val, col1: [{obj1: val}, {...}], col2: [{...}] } 

Otherwise, redefine the initialization of the Model to create and select two new dependent collections.

+2
source

All Articles