Maybe a silly question but where/how should I define default values for GORM domain class properties? For example when I'm creating a new Company object instance I want default value for property country to be "USA". I guess I could do it in create controller but it looks kinda dirty. Something like:
def create = {
def companyInstance = new Company()
companyInstance.properties = params
companyInstance.accepted = "USA"
...
Put it in the domain class itself
class Company {
String country = "USA"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With