collection.js
function() {
    var ret = Backbone.Collection.prototype.set.apply(this, arguments);

    this.each(function(model) {
      // Assign `db` to all models in the collection
      if (this.db) {
        model.db = this.db;
      }

      // Assign `user` to all models in the collection
      if (this.user) {
        model.user = this.user;
      }
    }.bind(this));

    return ret;
  }
function() {
    var ret = Backbone.Collection.prototype.set.apply(this, arguments);

    this.each(function(model) {
      // Assign `db` to all models in the collection
      if (this.db) {
        model.db = this.db;
      }

      // Assign `user` to all models in the collection
      if (this.user) {
        model.user = this.user;
      }
    }.bind(this));

    return ret;
  }
function ( ) { var ret = Backbone . Collection . prototype . set . apply ( this , arguments ) ; this . each ( function ( model ) { // Assign `db` to all models in the collection if ( this . db ) { model . db = this . db ; } // Assign `user` to all models in the collection if ( this . user ) { model . user = this . user ; } } . bind ( this ) ) ; return ret ; }
Override to assign `db` and `user` to all models in the collection on `set`
Note that the prototype must be called first and returned at the end
Override to assign db and user to all models in the collection on set Note that the prototype must be called first and returned at the end