RE: Layout Question .. (Sitemesh related)

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%>
<%[email protected]_for_layout%>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs