I wanted to set a limit for how many classes a Grails Domain class could relate to and I couldn’t see how to do it, so I put a call for help out on the Grails user list (user@grails.codehaus.org).
Burt Beckwith () showed me how:
class Author {
static hasMany = [ books : Book ]
String name
static constraints = {
books size: 0..3
}
}
class Book {
String title
}
Burt also pointed me to the doco: http://grails.org/do … onstraints/size.html.
Thanks, Burt!
