I am quite new to Grails and Groovy and found strange behaviour.
In one of my controller classes I have following list() method:
def list() {
[priceListInstanceList: PriceList.list(), priceListInstanceTotal: PriceList.count()]
}
and when I am calling this from my gsp g:select everything works fine:
<g:select name="priceListId" from="${vladar.PriceList.list()}" optionKey="id" optionValue="priceListName" />
Now if I will make a new method exactly the same like list() and change the name to list2()
def list2() {
[priceListInstanceList: PriceList.list(), priceListInstanceTotal: PriceList.count()]
}
and change g:select accordingly:
<g:select name="priceListId" from="${vladar.PriceList.list2()}" optionKey="id" optionValue="priceListName" />
I have get an error message:
Class
groovy.lang.MissingMethodException
Message
No signature of method: vladar.PriceList.list2() is applicable for argument types: () values: [] Possible solutions: list(), list(java.util.Map), last(), last(java.lang.String), last(java.util.Map), first()
It looks like there is some magic with list()
method under the hood.
I want to get a specific options in g:select
. I wrote controller part which render just fine but when I am trying to return values to gsp get the same message.
It seems it is general problem not with my controller.
Any ideas how to fix list2 so it will show in g:select
?
Thank you.