title: meta method inject on Grails Controller
body: <p>I wrote a plugin to inject a method into all controllers, I wrote this on          <code>doWithDynamicMethod {ctx -&gt; }</code></p>
  
  <pre><code>    for (classes in org.codehaus.groovy.grails.commons.ApplicationHolder.application.controllerClasses){
           def controllerClass = classes.clazz
           controllerClass.metaClass.static.doTestSearch &lt;&lt; {args -&gt;
               println "this is dynamic insertion --&gt;"+args.toString()
           }
           classes.class.metaClass.doTestSearch &lt;&lt; {args -&gt;
               println "this is dynamic insertion --&gt;"+args.toString()
           }
      }
  </code></pre>
  
  <p>When i tried to call this method in form in view, by :</p>
  
  <pre><code>&lt;g:form method="POST"&gt;
  
  &lt;g:actionSubmit class="save" action="doTestSearch"
              value="${message(code: 'default.button.search.label', default: 'Search')}" /&gt;
  </code></pre>
  
  <p>The method doesn't called and returning a 404 error.</p>
  
  <p>But when i tried to call it from controller by :</p>
  
  <pre><code>doTestSearch(params)
  </code></pre>
  
  <p>It works.</p>
  
  <p>Can someone please explain why is this happening ? And can i call the dynamic method directly from view ?</p>
  
  <p>Thank you in advance</p>
  
  <p>