How to change the default setting of a domain field in Grails to be nullable
I want any fi开发者_运维百科eld to be nullable in default.
You can place the following in grails-app/conf/Config.groovy if you are using 1.2+
grails.gorm.default.constraints = {
'*'(nullable:true,blank:true)
}
From here
The defaults for nullable, blank and the other gorm constraints can be configured in Config.groovy by adding a snippet such as:
grails.gorm.default.constraints = {
'*'(nullable:true,blank:true)
}
精彩评论