sequelize/sequelize — pull request #1072 by daronco (2013-11-23 20:33:25+00:00)
Title: Small fix for isDirty on setAttributes when using timestamps

Was setting `isDirty` to true whenever `setAttributes()` was called if using timestamps. A call to `setAttributes({})` (with the empty object) would set `isDirty` to true and `updatedAt` would be updated.
Modified to only update the column `updatedAt` if at least one attribute changed, so now you can call `setAttributes()` and `isDirty` will propertly indicate whether something changed.

I think there's a test missing for `setAttributes()`, to check that `updatedAt` is only updated if at least one attribute changed. But I couldn't find a block of tests for `setAttributes()` to add this one in.

The motivation behind it is that you can do something like:

```javascript
current.setAttributes({ at1: 1, at2: 2 })
if (current.isDirty) {
current.save().complete(function(err, result) {
done(null, result)
})
} else {
done(null, null)
}
```

So you can use`isDirty` to decide if the model needs to be saved or not. Otherwise the application has to do it's own verification of `attrs`, replicating what is already done in Sequelize.