Category Archives: Best Practices

Backbone JS – A Best Practice

This is a nice little tip I came across.  Avoid using model.toJSON() when rendering your Backbone JS Views.

Use model.attributes instead.

Using the toJSON method can work, but overloading the toJSON method of a model is required when you need to send data to an API does not a Rails flavor of a restful web service.  It does seem like a bad idea to use data designed to send to an API to render your view, when we can retrieve it unaltered through model.attributes.