client/lib/backbone-relational.js
changeset 158 1563d9be4a71
parent 138 e5be5cc9f09b
equal deleted inserted replaced
157:cdfc0b1547f3 158:1563d9be4a71
     1 /* vim: set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab: */
     1 /* vim: set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab: */
     2 /**
     2 /**
     3  * Backbone-relational.js 0.8.0+
     3  * Backbone-relational.js 0.8.5
     4  * (c) 2011-2013 Paul Uithol and contributors (https://github.com/PaulUithol/Backbone-relational/graphs/contributors)
     4  * (c) 2011-2013 Paul Uithol and contributors (https://github.com/PaulUithol/Backbone-relational/graphs/contributors)
     5  * 
     5  * 
     6  * Backbone-relational may be freely distributed under the MIT license; see the accompanying LICENSE.txt.
     6  * Backbone-relational may be freely distributed under the MIT license; see the accompanying LICENSE.txt.
     7  * For details and documentation: https://github.com/PaulUithol/Backbone-relational.
     7  * For details and documentation: https://github.com/PaulUithol/Backbone-relational.
     8  * Depends on Backbone (and thus on Underscore as well): https://github.com/documentcloud/backbone.
     8  * Depends on Backbone (and thus on Underscore as well): https://github.com/documentcloud/backbone.
  1790 	/**
  1790 	/**
  1791 	 * Override 'Backbone.Collection.reset' to trigger 'relational:reset'.
  1791 	 * Override 'Backbone.Collection.reset' to trigger 'relational:reset'.
  1792 	 */
  1792 	 */
  1793 	var reset = Backbone.Collection.prototype.__reset = Backbone.Collection.prototype.reset;
  1793 	var reset = Backbone.Collection.prototype.__reset = Backbone.Collection.prototype.reset;
  1794 	Backbone.Collection.prototype.reset = function( models, options ) {
  1794 	Backbone.Collection.prototype.reset = function( models, options ) {
       
  1795 		options = _.extend( { merge: true }, options );
  1795 		reset.call( this, models, options );
  1796 		reset.call( this, models, options );
  1796 
  1797 
  1797 		if ( this.model.prototype instanceof Backbone.RelationalModel ) {
  1798 		if ( this.model.prototype instanceof Backbone.RelationalModel ) {
  1798 			this.trigger( 'relational:reset', this, options );
  1799 			this.trigger( 'relational:reset', this, options );
  1799 		}
  1800 		}