Fix type error when using Model prototype #36

Closed
cthurston opened this Issue Mar 24, 2012 · 0 comments

Comments

Projects
None yet
2 participants

When using the validator as a Model prototype you may run into a type error on a model that does not have validation: defined.

I fixed it by checking first for validation then for the attr, but not sure if that is the best way because I'm not familiar with the rest of the code.

Near line 30:
var getValidators = function(model, validation, attr) {

  •          if(_.isEmpty(validation)) return;   //Seems to fix it.
           var attrValidation = validation[attr] || {};   //This line will throw the error if validation is undefined.
    

@thedersen thedersen closed this in 3efff48 Jul 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment