but a “global.rhtml” layout,
which calls “render :partial => “section_links””
would render “_section_links.rhtml”
in the appropriate directory.
so in the users controller it’ll render /users/_section_links.rhtml
and in the product controller it does /product/_section_links.rhtml.
maybe that’s what you want.
This will work if all sections are very similar, and require every
section to have section_links.rhtml, which should be ok in most
situations.
through trial and error, i found out this setup is more flexible. To
use namespace in layout file, and rename layout as partial.
so I copy layouts/application.rhtml to shared/layouts/
_application.rhtml
======== shared/layouts/_application.rhtml =============
.....
<%= render(:partial => "/shared/global_header") %>
<%= yield "top" %>
<%= yield %>
<%= render(:partial => “/shared/global_footer”) %>
======== layouts/product.rhtml =============
<% content_for :top do %>
product_home | hardware | software | …
<% end %>
<%= render(:partial => “/shared/layouts/application”) %>
======== layouts/support.rhtml =============
<%= render(:partial => “/shared/layouts/application”) %>
Product section wants a section navbar on top, so it just do that in
the product layout, for ProductController
Support section don’t need navbar, so it just skips it.
one drawback, namespaced part can not be cached.
Dorren