I'm a Grails beginner. I have a Domain class which has domainName field in Grails (ver. 2.0.1). In my DomainConstraints.groovy, I have:
constraints = {
domainName blank: false, matches: "^([^.]{0,63}\\.)*([^.]{1,63})\$"
}
but depending on some situation, i want to make this domainName field "blank: true" or "blank: false". I'm not validating my domain class against the actual database, so sync with the domain class and the actual table is not an issue.
So, I want to do something like this (code below is from my imagination):
if(something){
Domain.constraints.removeAttr('blank')
} else {
Domain.constraints.addAttr('blank', 'true')
}
Is this possible?