Grails Custom Scaffolding get access to controller name -
Grails Custom Scaffolding get access to controller name -
i trying write custom src/templates/scaffolding/controller.groovy
, wondering if there way access controller name? right seems can "model" class. reason need customizing render prefix templates directory based on controller.
for instance have controller named authoradmincontroller
, need customize list
utilize /admin/user/**
directory.
let me know if have questions. getting ready how customize defaultgrailstemplategenerator
not sure if right route go.
example:
class useradmincontroller { static scaffold = user }
currently in controller.groovy
classname='user' have no access controller.
i don't think can, way scaffolding works template always generating class named domainclassnamecontroller (i.e. usercontroller
in example), gets loaded new classloader , metaclass of real controller (useradmincontroller
) gets new actions added delegate instance of generated usercontroller
.
now every controller has access controllername
property during execution of actions, may provide workaround. haven't tried it, seek putting log.info("controller: \${controllername}")
template , see name gives (the backslash create resolve @ runtime rather generation time).
grails
Comments
Post a Comment