I'd like to use a standard validator in a custom validator.
I want to ensure the population and product field combo is unique ONLY if the model_type.has_range_options is false. I've tried the following but it is not working:
static constraints = {
client validator: {val, obj, errors ->
if (!obj.model_type?.has_range_options?.booleanValue()) {
unique: ['population', 'product']
}
}
}
Is there something else I could try?
I just ended up writing my own unique validation: