Grails: One controller for whole class hierarchy?
-
18-10-2022 - |
Question
Is it possible to use only one controller for several domain model classes if all those classes are in the same hierarchy (ie: they all inherit from the same base class)? So for example, can I create a FormController as my controller and have the following domain models be serviced by it:
Form
BigForm (inherits from Form)
SmallForm (inherits from Form)
OtherForm (inherits from Form)
If this is possible, how do I tell Grails to create the correct domain model object when entering some of the default methods like save, update, delete, etc.? Or in other words how do I make data binding work correctly with this setup?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow