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

Commit 1f720828 by Sascha Depold

fixed scoping of validation

1 parent 67e713f3
Showing with 17 additions and 10 deletions
......@@ -675,16 +675,23 @@ module.exports = (function() {
return new Utils.CustomEventEmitter(function(emitter) {
if (options.validate === true) {
this.build(attrValueHash).validate().success(function(errors) {
if (!!errors) {
emitter.emit('error', errors)
} else {
this
.QueryInterface
.bulkUpdate(this.tableName, attrValueHash, where, options)
.proxy(emitter)
}
}.bind(this))
var build = this.build(attrValueHash)
, attrKeys = Object.keys(attrValueHash)
build
.validate({
skip: Object.keys(build.dataValues).filter(function(val) { return attrKeys.indexOf(val) !== -1 })
})
.success(function(errors) {
if (!!errors) {
emitter.emit('error', errors)
} else {
this
.QueryInterface
.bulkUpdate(this.tableName, attrValueHash, where, options)
.proxy(emitter)
}
}.bind(this))
} else {
this
.QueryInterface
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!