def book = new Book(title: "The Shining").save(failOnError: true)
However, this gets annoying, having to pass the parameter every time that you call the "save" method. A solution is to declare it as the default setting and forget about it.
This can be done in Config.groovy, by adding the following line:
grails.gorm.failOnError=true
You can also add this configuration to specific packages, in case that you didn't want the configuration to apply to all of the packages used in your application:
grails.gorm.failOnError = ['com.companyname.somepackage','com.companyname.someotherpackage']
From: http://grails.org/doc/latest/guide/conf.html#configGORM
No comments:
Post a Comment