title: grails 3 overriding queryForResource not working
body: <p>According to <a href="https://grails.github.io/grails-doc/latest/guide/webServices.html" rel="nofollow">Grails Web Services</a></p>
  
  <p>I can override the method <a href="http://grails.github.io/grails-doc/3.0.0/api/grails/rest/RestfulController.html#queryForResource(java.io.Serializable)" rel="nofollow">queryForResource</a>. This way I may be able to specify nested REST resource. e.g</p>
  
  <pre><code>"/authors"(resources:'author') {
      "/books"(resources:'book')
  }
  </code></pre>
  
  <p>But the doc may be wrong. Because it uses an assigment operator <strong>=</strong> instead a comparison one <strong>==</strong>.</p>
  
  <p>Running This way I get the following error:</p>
  
  <pre><code>((id == id) &amp;&amp; building.id) is a binary expression, but it should be a variable expression
  </code></pre>
  
  <p>Changing the operator from <strong>=</strong> to <strong>==</strong> I get another error</p>
  
  <pre><code>Cannot query property "params" - no such property on class clash.BuildingLevel exists
  </code></pre>
  
  <p>What is the correct way to define this nested REST resource?</p>
  
  <p>Here is my queryForResource method:</p>
  
  <p>I tried both:</p>
  
  <pre><code>@Override
  protected BuildingLevel queryForResource(Serializable id) {
      if (params.buildingId) {
          return BuildingLevel.where {
              id == id &amp;&amp; building.id = params.buildingId
          }.find()
      }
  }
  
  
  @Override
  protected BuildingLevel queryForResource(Serializable id) {
      if (params.buildingId) {
          return BuildingLevel.where {
              id == id &amp;&amp; building.id == params.buildingId
          }.find()
      }
  }
  </code></pre>