Reputation: 45
Status
domain has many like
like
belongs to user
and status
user
has many status
and like
I need to show count of likes
a status
has.
<g:each in="${statusInstanceList}" status="i" var="statusInstance">
${fieldValue(bean: statusInstance, field: "statusMessage")}
<g:each var="likeInstance" in="${statusInstance.like}">
${likeInstance.count()} //this is the where likes should be counted via dynamic finders
</g:each>
</g:each>
Also please suggest if I am doing this the right way. If not please put me on to the right track.
Upvotes: 0
Views: 748
Reputation: 50285
${statusInstance.like?.size()}
should give the number of likes
per status
.
......
<g:set var="likesSize" value="${statusInstance.like?.size()}"/>
<g:each var="likeInstance" in="${statusInstance.like}">
$likesSize
</g:each>
.......
Makes sense?
Upvotes: 1