sequelize/sequelize — pull request #798 by mstorgaard (2013-07-31 19:50:05+00:00)
Title: Adding dirty tracking

This will add a dirty flag to objects.

New objects, that are built but not saved, will be flagged as dirty until they are saved.
Objects fetched from the database are not flagged as dirty, but if you change an attribute on that object without saving, the object will be flagged as dirty. If the attribute was set, but not actually changed, it will not be flagged as dirty.

As this tracking is hooked into the setters of the objects, it originally got flagged as dirty every time an object was created or built/saved, because id, createdAt, touchedAt, and updatedAt would be set, which I wrote check for. This is not the most beautiful thing to do, but I haven't found an alternative way of doing this.

All tests pass.