addyosmani/backbone-fundamentals — pull request #584 by backslashed (2014-05-10 22:40:40+00:00)
Title: Improved template rendering and suggestion [no conflict]

It is a better approach to use `model.attributes` instead of `model.toJSON()` when rendering templates, to allow scenarios when one wishes to alter the payload that is sent to the server. The `toJSON` function is used in [Backbone.sync](https://github.com/jashkenas/backbone/blob/master/backbone.js#L1212) for parsing.

In a situation where one would use an attribute called `description` in the model, but the server is expecting `desc`, one could solve this by overriding the `toJSON` function in the following manner:

```javascript
var MyModel = new Backbone.Model.extend({
toJSON: function() {
var attrs = _.clone(this.attributes);

attrs.desc = attrs.description;
delete attrs.description;

return attrs;
}
});
```

I think it might be useful to add a section in the book describing how to handle situations like this and the fact that `model.attributes` should be used when rendering templates to allow this kind of functionality.