Reputation: 563
Every reference to excluding properties from Grails scaffolded views revolves around adding them to the excludedProperties in the create.gsp and edit.gsp. Is it possible, and not unwise, to define excluded properties in the controller action rather than in the gsp?
Upvotes: 2
Views: 1382
Reputation: 1882
If you want to keep a field from showing up in the scaffolded views, you actually do it by modifying the domain class's constraints closure. For example:
class Book {
String name
Integer hideMe
static constraints = {
name blank:false
hideMe display:false
}
}
By adding "display:false" to the constraints for hideMe, it will prevent it from even showing on ANY of the scaffolded views. You can also set editable, password, format, etc to further control the ones that do show up. Take a look at the Grails documentation on constraints for more info (look at the bottom of this page: http://grails.org/doc/latest/ref/Constraints/Usage.html )
Upvotes: 4