Custom Controller Template is not taken into account when using dynamic scaffolding
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
As the title says the custom controller template is not taken into account when using dynamic scaffolding. I have created a simple project that reproduces this issue. The code works fine when using static scaffolding (the controller logs a message in the index action). In dynamic scaffolding however the code seems to be ignored and no message is logged in the index action.
Here is what i did:
1. created new project with grails create-app
2. grails install-templates
3. created a domain class book
4. Modified /templates/scaffolding/Controller.groovy to log something in the index action (and activated logging)
5. grails create-scaffold-controller then run-app and navigate to book/index (using dynamic scaffolding no message is logged. It is interesting to note that the template .gsp files are taken into account for dynamic scaffolding, while that does not seem to be the case for the Controller)
6. grails generate-controller then run-app and navigate to book/index (using static scaffolding the message is now logged)
I am using Grails 3.1.12, java version "1.8.0_45"
[Link to example project](https://github.com/ruppfa/grails-dynamic-scaffolding-not-using-templates)
Contributor guide
Research direction
Start by reproducing the issue with the listed Grails commands and the example project, comparing dynamic and static scaffolding. Inspect how /templates/scaffolding/Controller.groovy is loaded for each path; done means the custom controller template is honored by dynamic scaffolding and its index-action log appears when visiting book/index.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100