christopherweiss/Backbone-Factory — pull request #1 by dguzzo (2013-04-16 19:55:55+00:00)
Title: adjust the factories to not override Backbone's use of .id

Overriding the id attribute on a Backbone model, one of the fundamental ways in which Backbone IS what it is in terms of client/server persistence of data, is a **Bad Idea**.

For example, you could create a new factory instance, and then call the Backbone .isNew() method on it, and it'll return false. That's wrong; it's considered "new" until it's been saved to the server, not before then. Backbone's internals occasionally need to check for the newness of objects, and Backbone-Factory is clobbering that. By the way: this faulty (in my opinion) mechanism goes back to the original repo of Backbone-Factory, so it's been around this project for a while; my guess is that people haven't been able to write out tests to their full extent (such as adding/saving models to collections or other models).

The change I've made allows factory-created models to have a unique id via .factory_id, yet preserve the essence of Backbone's model persistence via its own .id management.

Please let me know if you believe I'm incorrect here; I could then provide examples of Jasmine specs where it would be a limiting factor.