不要怂,就是干,撸起袖子干!

Commit 27987383 by Ruben Bridgewater

Fix regression introduced in 2.1.2

1 parent 8ec1bf5f
# next
- [BUG] Fix regression introduced in 2.1.2: updatedAt not set anymore
# 2.1.2 # 2.1.2
- [BUG] `Model.create()/update()` no longer attempts to save undefined fields. - [BUG] `Model.create()/update()` no longer attempts to save undefined fields.
......
...@@ -1630,7 +1630,11 @@ module.exports = (function() { ...@@ -1630,7 +1630,11 @@ module.exports = (function() {
} }
}); });
} else { } else {
var updatedAtAttr = this._timestampAttributes.updatedAt;
options.fields = _.intersection(Object.keys(values), Object.keys(this.tableAttributes)); options.fields = _.intersection(Object.keys(values), Object.keys(this.tableAttributes));
if (updatedAtAttr && options.fields.indexOf(updatedAtAttr) === -1) {
options.fields.push(updatedAtAttr);
}
} }
if (this._timestampAttributes.updatedAt) { if (this._timestampAttributes.updatedAt) {
......
...@@ -164,7 +164,6 @@ var Utils = module.exports = { ...@@ -164,7 +164,6 @@ var Utils = module.exports = {
fields.forEach(function(attr) { fields.forEach(function(attr) {
if (dataValues[attr] !== undefined && !Model._isVirtualAttribute(attr)) { if (dataValues[attr] !== undefined && !Model._isVirtualAttribute(attr)) {
values[attr] = dataValues[attr]; values[attr] = dataValues[attr];
// Field name mapping // Field name mapping
if (Model.rawAttributes[attr] && Model.rawAttributes[attr].field && Model.rawAttributes[attr].field !== attr) { if (Model.rawAttributes[attr] && Model.rawAttributes[attr].field && Model.rawAttributes[attr].field !== attr) {
......
...@@ -18,7 +18,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -18,7 +18,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
} }
}); });
return Account.sync({force: true, logging: console.log}).then(function () { return Account.sync({force: true}).then(function () {
return Account.create({ return Account.create({
ownerId: 2 ownerId: 2
}).then(function (account) { }).then(function (account) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!