I'm trying to create my own CRUD controller in grails for the stuff that the scaffolding won't do.
Instead of maintaining code for a controller for each domain, I'd like to have one controller that can look after any domain for the generic CRUD calls.. as the only difference is the domain class name.
Using the example of domain class Job & Note
Instead of
Job.get(id)
Job.list()
def instance = new Job(params)
Note.get(id)
Note.list()
def instance = new Job(params)
I was thinking of
def someHandler = Job // configurable
someHandler.get(id)
someHandler.list()
def instance = new someHandler(params)
The first two static methods work fine (get, list) but creating a new instance does not. Any pointers as to how to best do this.
Cheers