documentcloud/backbone — pull request #1021 by ahamid (2012-02-17 09:08:55+00:00)
Title: small patch to allow passing options through reset to model initializer

I noticed that `reset` was not passing options through to `add`. this breaks what I think could be a nice idiom of passing (non-attribute) model initialization fields transparently through bulk methods without having to implement annoying setters just for the sake of initialization. test included.

Example:

``` javascript
var Model = Backbone.Model.extend({
initialize: function(attrs, options) {
this.model_parameter = options.model_parameter;
}
});
var col = new (Backbone.Collection.extend({ model: Model }))();
// now we can pass initialization data using a conventional Backbone collection method as opposed
// to hand rolling a loop and custom initializing every model
col.reset([{ astring: "green", anumber: 1 }, { astring: "blue", anumber: 2 }], { model_parameter: 'model parameter' });
```