Hi
I have the following domain classes:
class User = {
String username
...
Company company
}
class Company {
String name
...
}
That is, there is a n:1 relationship between user and company. These classes are so and I cannot change them.
At the show.gsp I want to have the details of the company together with links to the users who belongs to this company.
I know that I can achieve this writing an own tag, but I am sure that this would be possible using the each tag or the the findAll tag.
If I do the following
<g:each in="${User.findAll('from User order by username')}" var="userInstance">
<li><g:link controller="role" action="show"
id="${userInstance.id}">${userInstance.encodeAsHTML()}</g:link>
</li>
</g:each>
I've tried to pass the ${companyInstance} as a parameter but either I got an exception or it didn't work.
I've also tried using User.findAllByCompany.
When using:
<g:findAll in="${user}" expr="it.company == ${companyInstance} ">
I am getting an empty set.
Is there an easy way to achieve this without writing a taglib?
Thanks in advance.
Luis