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

Commit fb4345c3 by Domas Lapinskas

set validate option default to true for DAO-Factory.update

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