Fix a bug when validation is off for findOrCreate

This commit is contained in:
Amir Jafarian 2016-01-06 17:24:07 -05:00
parent 1771bfabcc
commit a5150265ec
1 changed files with 2 additions and 2 deletions

View File

@ -758,12 +758,12 @@ DataAccessObject.findOrCreate = function findOrCreate(query, data, options, cb)
// options has precedence on model-setting
if (options.validate === false) {
_findOrCreate(query, data, obj);
return _findOrCreate(query, data, obj);
}
// only when options.validate is not set, take model-setting into consideration
if (options.validate === undefined && Model.settings.automaticValidation === false) {
_findOrCreate(query, data, obj);
return _findOrCreate(query, data, obj);
}
// validation required