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

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