title: Cannot use grails g.link in domain class
body: <p>I have static method in a domain class that returns a url.  I need to build that url dynamically but g.link isn't working.</p>
  
  <pre><code>static Map options() {
      // ...
      def url = g.link( controller: "Foo", action: "bar" )
      // ...
  }
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <pre><code>Apparent variable 'g' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
  You attempted to reference a variable in the binding or an instance variable from a static context.
  You misspelled a classname or statically imported field. Please check the spelling.
  You attempted to use a method 'g' but left out brackets in a place not allowed by the grammar.
   @ line 17, column 19.
             def url = g.link( controller: "Foo", action: "bar" )
                       ^
  
  1 error
  </code></pre>
  
  <p>Obviously my problem is that I am trying to access <code>g</code> from static context, so how do I get around this?</p>