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

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 1 additions and 3 deletions
......@@ -196,10 +196,8 @@ Instance.prototype.get = function(key, options) { // testhint options:none
return this.dataValues[key];
}
}
if (this.dataValues) {
return this.dataValues[key];
}
}
if (this._hasCustomGetters || (options && options.plain && this.$options.include) || (options && options.clone)) {
var values = {}
......
......@@ -925,7 +925,7 @@ Model.prototype.refreshAttributes = function() {
this.Instance.prototype._hasCustomSetters = Object.keys(this.Instance.prototype._customSetters).length;
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);
return;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!