p3drosola/Backbone.VirtualCollection — pull request #33 by enov (2014-04-07 15:17:12+00:00)
Title: Add initialize function, the Backbone way

The `initialize` function, the Backbone way, in order to do some things along these lines:

var Subset_Collection_Appointment = Backbone.VirtualCollection.extend({
initialize: function() {
this.model = this.collection.model;
this.url = this.collection.url;
},
filter_by_doctor: function(doctor) {
this.updateFilter(function(appointment) {
return appointment.get('doctor').id == doctor.id;
});
}
});

(no need to do `this.model = this.collection.model;` anymore, courtesy @fcsonline)

Thank you :)