I'm using Grails 3.2:
class Training{
boolean clientChanged = false
static transients = ['clientChanged']
static hasMany = [clients:User]
//...
def beforeUpdate(){
clientChanged = this.isDirty('clients')
}
def afterUpdate(){
if(clientChanged && section.clients)
numberOfAbsentClients = section.clients.size() - (clients.size()?:0)
}
}
isDirty()
is not working for hasMany associations. how can I handle it?