jdaugherty opened a new issue, #249:
URL: https://github.com/apache/grails-intellij-plugin/issues/249

   Using Grails 3.1.1, IntelliJ 15.0.3 (143.1821)
   
   1. Create a new Grails project (using Intellij)
   2. Create a controller/view (using Intellij)
   ==> The action "index" is not recognized as an action: the action in the 
controller is marked as unused, the parameter in the view is not recognized and 
not navigable, the GSP icon doesn't appear in the margin
   
   3. Change the action from a method to a closure:
   ```
       def index() {
           return [
                   name: 'World'
           ]
       }
   ```
   Change to
   ```
       def index = {
           return [
                   name: 'World'
           ]
       }
   ```
   ==> Now everything gets back in place: the icon appears, the action is no 
longer marked as unused, ctrl-click on a parameter in the view navigates to the 
controller.
   
   Using closures instead of method is not a good workaround, as the Grails 
documentation says:
   
   > In earlier versions of Grails actions were implemented with Closures. This 
is still supported, but the preferred approach is to use methods.
   > Leveraging methods instead of Closure properties has some advantages:
   > - Memory efficient
   > - Allow use of stateless controllers (singleton scope)
   > - You can override actions from subclasses and call the overridden 
superclass method with super.actionName()
   > - Methods can be intercepted with standard proxying mechanisms, something 
that is complicated to do with Closures since they're fields.
   
   ---
   
   *Imported from 
[IDEA-151975](https://youtrack.jetbrains.com/issue/IDEA-151975) · Type: Bug · 
Votes: 0*
   *Comments, attachments, dates and reporter are not part of the export — 
follow the link above for the full history.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to