2

How to declare a method inside a closure.Or which is better to use method or closure. I have a closure and in that closure i have a method to call and i defined method as

 def getBindedGenes(Long colId) { ........ } 

But when i used codenarc plugin for code review it is showing the rule as GrailsPublicControllerMethod and the message as The Grails controller has a public method getBindedGenes. This should be a closure property or moved What is the cause and what is happening exactly.

Thanks in advance

1 Answer 1

8

I think CodeNarc is warning you that your controller actions must be public closures, not public methods. Given that you can't use a public controller method as an action, there's probably no good reason to have one.

Grails 2.0 Update

Since Grails 2.0, public methods of controllers can be used as actions, and if fact, it is now recommended to use methods instead of closures.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.