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

Commit b6a81c2e by Domas Lapinskas

don't do "variable || true" to cast to bool

1 parent 1c16932d
...@@ -654,7 +654,7 @@ module.exports = (function() { ...@@ -654,7 +654,7 @@ module.exports = (function() {
*/ */
DAOFactory.prototype.update = function(attrValueHash, where, options) { DAOFactory.prototype.update = function(attrValueHash, where, options) {
options = options || {} options = options || {}
options.validate = options.validate || true options.validate = Boolean(options.validate)
if(this.options.timestamps) { if(this.options.timestamps) {
var attr = Utils._.underscoredIf(this.options.updatedAt, this.options.underscored) var attr = Utils._.underscoredIf(this.options.updatedAt, this.options.underscored)
......
...@@ -288,7 +288,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() { ...@@ -288,7 +288,7 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
Model.sync({ force: true }).success(function() { Model.sync({ force: true }).success(function() {
Model.create({name: 'World'}).success(function(model) { Model.create({name: 'World'}).success(function(model) {
Model.update({name: ''}, {id: 1}).error(function(err) { Model.update({name: ''}, {id: 1}, {validate:true}).error(function(err) {
expect(err).to.deep.equal({ name: [ 'String is empty: name', 'String is empty: name' ] }) expect(err).to.deep.equal({ name: [ 'String is empty: name', 'String is empty: name' ] })
done() done()
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!