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

Commit 14b5c273 by Jochem Maas

when we validate - just do it on the contained dataValues, and lets actually che…

…ck that we have a rawAttribute definition for each value we attempt to validate (seems that it is possible to set stuff into a doa instance even though the model does not know about a given property)
1 parent 97e063d2
Showing with 2 additions and 2 deletions
......@@ -35,9 +35,9 @@ var validateAttributes = function() {
var errors = {}
// for each field and value
Utils._.each(this.model.values, function(value, field) {
Utils._.each(this.model.dataValues, function(value, field) {
var rawAttribute = this.model.rawAttributes[field]
, hasAllowedNull = ((rawAttribute.allowNull === true) && ((value === null) || (value === undefined)))
, hasAllowedNull = ((rawAttribute === undefined || rawAttribute.allowNull === true) && ((value === null) || (value === undefined)))
if (this.model.validators.hasOwnProperty(field) && !hasAllowedNull) {
errors = Utils._.merge(errors, validateAttribute.call(this, value, field))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!