Browse files

Instances which fail validation should still have properties set

  • Loading branch information...
1 parent 3bee8b0 commit ed652188b4c5b0789424295bdbe88c252bb41e2d @mde mde committed Oct 16, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/index.js
View
4 lib/index.js
@@ -642,11 +642,13 @@ utils.mixin(model, new (function () {
// contains an Object literal keyed by field name, and the
// error message for the first failed validation for that
// property
+ // Use raw, invalid value on the instance
if (validated.err) {
errs = errs || {};
errs[p] = validated.err;
+ item[p] = params[p];
}
- // Otherwise add this property to the return item
+ // Otherwise add the type-coerced, valid value to the return item
else {
item[p] = validated.val;
}

0 comments on commit ed65218

Please sign in to comment.