My REST API needs related resources sent as a string with the related resource uri.
So I configured includeInJSON == Backbone.Model.prototype.idAttribute
includeInJSON == Backbone.Model.prototype.idAttribute
But now when I render a template for this model, I can no longer access any of the related model's attributes, because when calling toJSON, only the resource uri is serialized.
Did anybody have this problem? What did you do to work around this issue?
Backbone has recently clarified that the mean purpose of toJSON is for server serialization. You have other options when it comes to template rendering.
But see #161 and #183 for a related proposal
Closing as dup of #183. In general, it's better to just pass the model itself into the template, and use the get accessors`.