addyosmani/backbone-fundamentals — pull request #578 by backslashed (2014-04-07 19:33:49+00:00)
Title: Improved template rendering and suggestion

It is a better approach to use `model.attributes` instead of `model.toJSON()` for 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#L1222) for parsing.

In a situation where one would use an attribute called `description` in the model and the server expects `desc`, one could solve this by overwriting 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.