I recently started a new Grails project and I'm trying to use the scaffold feature as much as I can. I installed the templates with grails install-templates and modified them so they rely on the current controller if certain methods are available (for example, the show method would call the renderShow method if available).
The problem I have is that when that method is called from the scaffold template, it's not found hence an exception is thrown. If the same method is called from the actual controller, it works as expected.
What I'm missing?
To ilustrate the question, I created a small project. The interesting commit is this one: https://github.com/deigote/GrailsScaffoldingMethodCallProblem/commit/0fce966bad6e8004a7133511149c09de54be24bf
When running the app, if you go to the testDemoMethod (.../GrailsScaffoldingMethodCallProblem/demo/testDemoMethod) you "Hi, I'm a method" rendered, and the following is printed:
[public java.lang.Object grailsscaffoldingmethodcallproblem.DemoController.this$2$demoMethod()]
But if you go to the index (.../GrailsScaffoldingMethodCallProblem/demo/testDemoMethod) an empty list is printed and I obtain an exception:
Message: No signature of method: grailsscaffoldingmethodcallproblem.DemoController.demoMethod() is applicable for argument types: () values: []
Line | Method
->> 11 | index in grailsscaffoldingmethodcallproblem.DemoController
Any clue why is this happening or how to get around it?
Edit: Ian Robert's answer solved the question: Controller method not found if called from scaffolding template