Fix a bug when validation is off for findOrCreate

This commit is contained in:
Amir Jafarian 2016-01-06 17:24:07 -05:00 committed by Simon Ho
parent 174237e6a6
commit 2423db1571
1 changed files with 2 additions and 2 deletions

View File

@ -757,12 +757,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