How to disable automatic generation?

Hi.

I have a Grails app. Every time I create a domain class via New -> Grails -> Grails Controller, I'll end up with a fully scaffolded controller, which is annoying because I have to always delete everything in the controller to work with my own actions. Is it possible to disable the automatic generation?

Kind regards,
Bernd

5 comments
Comment actions Permalink

The controller is createdi with launching external grails, so we have no control over it.

Eugene.

0
Comment actions Permalink

Hi Eugene.

There's a difference between 'create' and 'generate'. I thought that the command sequence 'new -> grails -> grails controller' creates a controller, but it generates one.

I would like to have different commands available in JetGroovy, since in the normal Grails work you will far more create things than generate them. Generating is scaffolding and that's only worth if one starts with Grails, to help him with his first steps through the framework.

In the commands there seems to be a mix of 'create' and 'generate'

new
|-Grails
|-create application
|-create domain class
|-generate controller
|- ...

So I would suggest the following commands:
new
|-Grails
|-create application
|-create domain class
|-create controller
|-create service
|-create script
|-create taglib
|-generate
|-controller
|-views
|-all

Now, that would be more explicit, wouldn't it?

Bernd

0
Comment actions Permalink

That isn't quite true in this case. When "New->Grails->Grails Domain Class" is invoked, the result is the same as if you ran "grails create-domain-class " followed by "grails generate-controller ". However, the new domain and controller classes are generated internally by the plugin using templates. External Grails scripts are used for all other Grails-related actions. Specifically, "New->Grails->Grails Controller" forks out to run "grails create-controller ]]>".

I suggest adding a separate menu action to create a domain class using the grails scripts and label the existing template-driven action as such. Beyond that, I'm not sure template-driven scaffold generation is ever really very useful. I wouldn't think many Grails developers are going to be interested in using templates to change the scaffolding from that provided by Grails. Domain class templates can be handy, however. Scaffolding isn't useful until the associated domain class has been fleshed out, anyway.

If you go this route, I also think it would be better to put controller generation in the editor menus for domain classes, as is currently done with "generate-views". I think that would be preferable to including the "generate-" actions in the menu since generate actions are inherently associated with a domain class.

0
Comment actions Permalink

I agree with jeb completely on: "I also think it would be better to put controller generation in the editor menus for domain classes".

0
Comment actions Permalink

Ah, I see this is the already the case in the 1.5 eap. Nice!

0

Please sign in to leave a comment.