I am wondering if there is any way to pass in a value when I instantiate a new Collection, which will be set as a property on all new models that are added to the collection. E.g.,
allSchools = [/* list of schools */];
this.schoolTypes = new Backbone.Collection([], { model:SchoolType }); //pass in allSchools here, somehow
this.schoolTypes.add({name:'New SchoolType'});
where the newly added Model will have a this.allSchools (or this.options.allSchools or something like that). Seems there should be a simple enough way to do this? Currently I’m just accessing a global allSchools object but its not very modular.
As mu mentioned in his comment, models have a built-in .collection property. So, if I set a property on the collection, I can access it from any model within the collection like so: