Forum: Ruby on Rails RE: Layout Question .. (Sitemesh related)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mufaddal K. (Guest)
on 2006-04-01 03:09
(Received via mailing list)
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"%>
<div id='menu'></div>
<div id='main'> <%=@content_for_layout%> </div> </body> </html>
This topic is locked and can not be replied to.