documentcloud/backbone — pull request #1539 by Eric-Wright (2012-08-09 22:27:00+00:00)
Title: New Model extension point: idFromAttributes 

There have been several issues raised previously (#598, #1215, #1232) to add support for nested ids in models. The previously-proposed solutions all baked in support in `Backbone.Model.set` for specific nesting schemes, and all were rejected with a a note that this type of functionality should be included as a plugin or extension.

The issue with `Backbone.Model.set` today is that it doesn't allow for easy extension to change this behavior - extensions have to completely replace `set` to change this behavior, which is fragile. This pull request adds a new `idFromAttributes` method to `Backbone.Model`, with the default behavior identical to the existing attribute-to-id mapping behavior. But this enables extension to easily replace `Backbone.Model.idFromAttributes` as needed without affecting other `set` behavior.