Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Controller Template is not taken into account when using dynamic scaffolding #34

Open
ruppfa opened this issue Sep 29, 2016 · 3 comments

Comments

@ruppfa
Copy link

ruppfa commented Sep 29, 2016

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

@fbartnitzek
Copy link

I'm having the same problem with grails v3.2.8.
Only the gsp-templates are used, in contradiction to the documentation

In my example the RaceController uses dynamic scaffolding: the corresponding template should show 15 entries in the index-method, but only 10 entries get listed.
The un-dynamic RunnerController has a hard-coded method and 15 entries work.

In grails v2.5.5 the controller-templates were actually used and we customized them to use a session-variable for that:

 def index(Integer max) {
        params.max = Math.min(max ?: session["page_size"]?.toInteger()?:10, 1000)
        //...
    }

Please fix it.

@kuceram
Copy link

kuceram commented Mar 12, 2018

Having the same issue with Grails 3.3.2. Any updates in regards of this?

@davebrown1975
Copy link

Any chance of comment from the team? Is this something we might see restored in the future? If not, could you please update the docs and the install-templates script so it doesn't create a controller template which is redundant if we can't use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants