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

Commit 719701bd by Robert Grimes

Updated the fix for user defined attributes overwriting builtins.

More appropriate fix for the merge: https://github.com/sequelize/sequelize/pull/5219
Now uses hasOwnProperty to more accurately check if the user attribute
matches a builtin.
1 parent 41fc3d21
Showing with 2 additions and 4 deletions
...@@ -196,9 +196,7 @@ Instance.prototype.get = function(key, options) { // testhint options:none ...@@ -196,9 +196,7 @@ Instance.prototype.get = function(key, options) { // testhint options:none
return this.dataValues[key]; return this.dataValues[key];
} }
} }
if (this.dataValues) { return this.dataValues[key];
return this.dataValues[key];
}
} }
if (this._hasCustomGetters || (options && options.plain && this.$options.include) || (options && options.clone)) { if (this._hasCustomGetters || (options && options.plain && this.$options.include) || (options && options.clone)) {
......
...@@ -925,7 +925,7 @@ Model.prototype.refreshAttributes = function() { ...@@ -925,7 +925,7 @@ Model.prototype.refreshAttributes = function() {
this.Instance.prototype._hasCustomSetters = Object.keys(this.Instance.prototype._customSetters).length; this.Instance.prototype._hasCustomSetters = Object.keys(this.Instance.prototype._customSetters).length;
Object.keys(attributeManipulation).forEach((function(key){ Object.keys(attributeManipulation).forEach((function(key){
if (this.Instance.prototype[key] !== undefined) { if (Instance.prototype.hasOwnProperty(key)) {
this.sequelize.log("Not overriding built-in method from model attribute: " + key); this.sequelize.log("Not overriding built-in method from model attribute: " + key);
return; return;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!