title: Grails populate g:select from database
body: <p>I ran into an issue while populating domain object values on a gsp page by using a <code>g:select</code> tag.</p>
  
  <pre><code>&lt;g:select name="demo" id="demo"
            value="${dm.id}"
            noSelection="${['null':'Select..']}"
            from="${dm}"
            optionValue="${dm.type}"/&gt;
  </code></pre>
  
  <p>In my controller, I have an object which gathers values from my domain. I tried writing this object in the controller both as:</p>
  
  <pre><code> def d = Demo.getAll()
  </code></pre>
  
  <p>and  <code>def d = Demo.list()</code></p>
  
  <p>Both of these returned an exception while trying to use the <code>g:select</code> tag. The error was:</p>
  
  <p><strong>No signature of method: Demo.getAt() is applicable for argument types: (java.util.ArrayList) values: [[One, Two, Three, Four, Five]]</strong></p>
  
  <p>I was able to get my code working by simply removing the <code>g:select</code> tag and writing the following in my gsp:</p>
  
  <pre><code>    &lt;select name="demo" id="dm"&gt;
      &lt;option value=""&gt;Select!&lt;/option&gt;
      &lt;g:each in="${dm}" status="i" var="dm"&gt;
          &lt;option value="${dm.id}"&gt;${dm.name}&lt;/option&gt;
      &lt;/g:each&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>However, I would like to know how to make this work with the <code>g:select</code> tag, for my future reference.</p>
  
  <p>Thanks in advance!</p>