Imagine I have defined the following custom validator function:
isUnique: function () { // This works as expected
throw new Error({error:[{message:\'Email addr
Success callback is called even if no user is found. You have to check if the function passes a user as an argument:
isUnique: function (email) { // This doesn't work
var User = seqeulize.import('/path/to/user/model');
User.find({where:{email: email}})
.success(function (u) { // This gets called
if(u){
throw new Error({error:[{message:'Email address already in use!'}]}); // But this isn't triggering a validation error.
}
});
}