Closed apawsey closed 8 years ago
Hey this is great thanks - does this look like it will meet your needs -
static presence(config = true) {
return new ValidationRule('presence', config);
}
Basically instead of just hardcoding the config as true
which is a valid option for those listed above we just supply a default value if none is passed and use that.
Yup perfect, seems easier to just bring them in line with the others. Obviously this depends on whether you want us passing things through to validate.js or you want to abstract those settings somehow?
Personally I love giving the developer full control over validatejs because it highlights how easy to use it is / should be. Perhaps there is a reason we want to abstract down the road but for now I love it the way it is :)
I'll get a fix in for this before tomorrow.
In ValidationRule, the static properties that return the validation rule instances for those validator types, do not carry any config passed in through to the validate.js library (rather just passing true). Therefore the ability to set certain options, like overriding the validation message, is not possible.