dhruvaray/backbone-associations — pull request #78 by astjohn (2013-10-21 18:28:15+00:00)
Title: Add remoteKey for json serializing relations to different key name.

During our migration from Backbone Relational, we were only missing one feature: setting a different key/property name for a related model during toJSON(). A popular use case for this is when using Ruby on Rails with nested attributes. Often the server is expecting related models to be scoped under `keyname_attributes` while the client side related model might only be scoped under `keyname`.

Attached is a tiny fix which is similar to `keyDestination` in Backbone Relational, however, in this commit, the keyname is `remoteKey` as I feel this is more explicit.

All tests currently pass, but I have yet to add one for this feature due to time and the fact that I'm not too familiar with qunit.

What do you think?