RE: Layout Question .. (Sitemesh related)


#1

Just found the answer to my post.

If somebody else is looking for an answer to a similar question:

In Rails, layouts have access to all the same data that is available to
conventional templates. Any instance variables set in the normal
template will be available in the layout.

Following my previous example you could do this:

My template file t1.rhtml:

Some content <% @show_menu = "true" %>

And this is the layout1.rhtml (layout file that t1 gets decorated with):

<%if @show_menu == "true"%>
<%end%>
<%=@content_for_layout%>