I am attempting to do a findAllWhere in a grails gsp passing in 2 variables: one that is the attribute and one that is the value I want that attribute to equal. I.E (author: Mark Twain) I cannot figure out the syntax and the error I am receiving does not help.
${Application.findAllWhere((${group1}): ${group})}
Group1 is a variable passed from the controller, and group is a variable from a g:each. Here is the error.
Error 500:
Servlet: default
URI: /archetype/application/applicationPortfolio/GroupLangTechOwn
Exception Message: No signature of method:
C__projects_Archetype_grails_app_views_application_applicationPortfolio_gsp.$() is
applicable for argument types:
(C__projects_Archetype_grails_app_views_application_applicationPortfolio_gsp$_run_closure2_closure56_closure144) values: [C__projects_Archetype_grails_app_views_application_applicationPortfolio_gsp$_run_closure2_closure56_closure144@239dbdd6] Possible solutions: is(java.lang.Object), run(), run(), any(), use([Ljava.lang.Object;), any(groovy.lang.Closure)
Caused by: Error processing GroovyPageView: No signature of method: C__projects_Archetype_grails_app_views_application_applicationPortfolio_gsp.$() is applicable for argument types: (C__projects_Archetype_grails_app_views_application_applicationPortfolio_gsp$_run_closure2_closure56_closure144) values: [C__projects_Archetype_grails_app_views_application_applicationPortfolio_gsp$_run_closure2_closure56_closure144@239dbdd6] Possible solutions: is(java.lang.Object), run(), run(), any(), use([Ljava.lang.Object;), any(groovy.lang.Closure)
Class: applicationPortfolio.gsp
At Line: [631]
Thanks!
Try simplifying to: ${Application.findAllWhere(group: group)}
as Weezle indicated
But it is typically better to put this in the controller and return eg:
class MyContoller {
def myAction() {
[appList: Application.findAllWhere(group: group)]
}
myAction.gsp
${appList}
<g:each var="app" in="${appList}">
${app.id} - ${app.name}
</g:each>