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

Commit dcfeccc2 by smihica

option object shouldn't be updated internally.

1 parent 364e601d
Showing with 5 additions and 5 deletions
......@@ -482,7 +482,7 @@ Instance.prototype.save = function(options) {
if (arguments.length > 1) {
throw new Error('The second argument was removed in favor of the options object.');
}
options = _.defaults(options || {}, {
options = _.defaults({}, options || {}, {
hooks: true,
validate: true
});
......@@ -724,7 +724,7 @@ Instance.prototype.save = function(options) {
* @return {Promise<this>}
*/
Instance.prototype.reload = function(options) {
options = _.defaults(options || {}, {
options = _.defaults({}, options || {}, {
where: this.where(),
limit: 1,
include: this.options.include || null
......@@ -828,7 +828,7 @@ Instance.prototype.destroy = function(options) {
for(var i = 0; i < primaryKeys.length; i++) {
where[this.Model.rawAttributes[primaryKeys[i]].field] = this.get(primaryKeys[i], { raw: true });
}
return this.sequelize.getQueryInterface().delete(this, this.Model.getTableName(options), where, _.defaults(options, { type: QueryTypes.DELETE,limit: null}));
return this.sequelize.getQueryInterface().delete(this, this.Model.getTableName(options), where, _.defaults({}, options, { type: QueryTypes.DELETE,limit: null}));
}
}).tap(function() {
// Run after hook
......@@ -913,7 +913,7 @@ Instance.prototype.increment = function(fields, options) {
}
}
options = _.defaults(options || {}, {
options = _.defaults({}, options || {}, {
by: 1,
attributes: {},
where: {}
......@@ -970,7 +970,7 @@ Instance.prototype.increment = function(fields, options) {
* @return {Promise}
*/
Instance.prototype.decrement = function(fields, options) {
options = _.defaults(options || {}, {
options = _.defaults({}, options || {}, {
by: 1
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!