recipeswithbackbone/recipeswithbackbone.github.com — Issue #46: _.bindAll
Author: redthor
Created: 2012-02-29 01:21:04+00:00
State: open

Hi Guys,
Thanks for the book.

```
_.bindAll()
```

is used in a few spots and I understand what it does from the [underscore site](http://documentcloud.github.com/underscore/#bindAll), but I'm unsure as to why it is required where it is used. I may have missed where you explain why it is necessary. For e.g. (version 2012-01-02 of the book, page 54):

```
Views.Appointments = Backbone.View.extend({
template: Templates.Appointments,
initialize: function(options) {
_.bindAll(this, 'render', 'addAll', 'addOne');
this.collection.bind('add', this.addOne);
},
...
```

is it necessary to bindAll 'render', 'addAll', and 'addOne'?

Next question: Is using bindAll now deprecated in favor of:

```
this.collection.on('add', this.addOne, this);
```

Thanks.