I am experiencing a weird issue with createlink. I have this in my gsp
<g:createLink controller="uni" action="show" id="1" />
I expect it to generate something like
"/uni/show/1"
However, it actually gives me
"/uni/create?id=1"
I also tried inline version as well,
${createLink(controller:'uni', action:'show', id:1) }
this also gives
"/uni/create?id=1"
Any help is greatly appreciated! Thanks!
UPDATE
I managed to fix it by adding a url mapping for "show" action
The problem may come from url mapping bug. I have this defined in my urlmappings.groovy
"/uni/create"(controller:"uni"){
action = [GET:"create", POST:"createDetail"]
}
This somehow cause it to generate wrong link. I have no idea why, it will be nice if someone can explain it
After I add this line before "create", the problem is gone.
"/uni/show/$id"(controller:"uni",action:"show")