I have a domain class with a Collection of simple Strings as one of it’s members
class Customer {
String name;
static hasMany = [ aliases:String ]
static constraints = {
name blank:false
}
}
I’m wondering if I can add the aliases to the grails scaffolding? and if so, how?
Thanks,
Grails does not do scaffolding for arrays. The hasMany is designed to be used with another domain class, not a variable. Using hasMany with a domain class will generate automatic scaffolding. For example
This would create two tables, customer and alias. A foreign key would be used to associate records in the alias table with a customer. The collection of aliases would be accessed by
If you have to use an array instead of another domain class you will have to write custom code for the user interface.