Hi,
Is there a way to write a custom validator that will perform different validations according to field values?
For example
class myModel{
A a;
B b;
String prop
static belongsTo:[m:myModel]
constraints{
prop(validator:{
val,obj->
if (obj.a== null){
unique:[b,prop]
}
else{
unique:[a,b,prop]
}
})
}
}
I'm quite confused about this.
Thanks in advance