I have a template which I render with:
<g:render template="recordInfo" />
in my main-layout. (layout/main.gsp).
That's a template, which some of my views need and some views don't.
For the views, which don't need that template, I put an empty file with the name in the top-level-views directory (/grails-app/views). As described in the grails documentation:
Without the leading '/' it will be first be resolved relative to the
current controller's view directory then, failing that, the top level
views directory.
It works fine for the views which have the template-file in the own view-directory (e.g. /grails-app/views/address). But it doesn't work, where grails should search the template at the /grails-app/views level.
Do I understand something wrong from the documentation or do I have an error in my code?
My file/directory structure looks like:
...
MyApp/grails-app/views/_recordInfo.gsp
MyApp/grails-app/views/address/_form.gsp
MyApp/grails-app/views/address/ ...
MyApp/grails-app/views/address/_recordInfo.gsp
MyApp/grails-app/views/contact/_form.gsp
MyApp/grails-app/views/contact/ ...
...
The address-view needs a customized _recordInfo template and the contact-view don't need it (and therefore I thought grails would pick up the one in the MyApp/grails-app/views directory...)