|
Hi there,
I have a question regarding filtering queries. I try to query a domain class with findAll* within a gsp template. I got this situation: class BuddyList { static belongsTo = User User owner ... } In my GSP template I try to do this: <g:set var="user" value="${loggedInUserInfo(field:'userName')}" /> <g:render template="/common/buddyList" var="list" collection="${BuddyList.findAllByOwner(user)}" /> Unfortunately I got an exception: No signature of method: BuddyList.findAllByOwner() is applicable for argument types: (java.lang.String) values: {"john"}. I'm using SpringSecurity (aka Acegi). Ok, this method needs an user object but is there a way to get this working anyway? I also tried BuddyList.findAllWhere(owner:user) but this is also not working. Can someone explain what I'm doing wrong? Cheers AGU |
|
If your user value is userName, shouldn't your query be against user.name?
${BuddyList.findAllByOwner( user.name )} On Sun, Oct 26, 2008 at 6:31 PM, A_Grails_User <[hidden email]> wrote: > > Hi there, > > I have a question regarding filtering queries. I try to query a domain class > with findAll* within a gsp template. > > I got this situation: > > class BuddyList { > > static belongsTo = User > User owner > ... > > } > > In my GSP template I try to do this: > > <g:set var="user" value="${loggedInUserInfo(field:'userName')}" /> > <g:render template="/common/buddyList" var="list" > collection="${BuddyList.findAllByOwner(user)}" /> > > Unfortunately I got an exception: > No signature of method: BuddyList.findAllByOwner() is applicable for > argument types: (java.lang.String) values: {"john"}. I'm using > SpringSecurity (aka Acegi). Ok, this method needs an user object but is > there a way to get this working anyway? I also tried > BuddyList.findAllWhere(owner:user) but this is also not working. Can someone > explain what I'm doing wrong? > > Cheers > AGU > -- > View this message in context: http://www.nabble.com/findAll*-question-in-gsp-template-tp20178783p20178783.html > Sent from the grails - user mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Thanks but this is not working. I think I put this into a taglib. If there is any other way to solve this, please let me know.
Greets AGU
|
| Powered by Nabble | Edit this page |
