Ruby-on-rails – Nested layouts in ruby on rails


I'm new to rails and am trying to work out how to get nested layouts working; I'm assuming they're a bit like .net master pages?

I've followed this guide and I've created an application.erb.html in my layout directory which contains this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" xml:lang="en" lang="en">
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title><%= @page_title or 'Page Title' %></title>
  <%= stylesheet_link_tag 'layout' %>
  <style type="text/css"><%= yield :stylesheets %></style>

<%= yield(:content) or yield %>


and have modified one of my existing layouts to this:

<% content_for :stylesheets do %>

<% end -%>

<% content_for :content do %>
  <p style="color: green"><%= flash[:notice] %></p>
  <%= yield %>
<% end -%>

<% render :file => 'layouts/application' %>

When I go to one of my views in the browser, absolutely nothing is rendered; when I view source there is no html.

I'm sure there's something elementary I've missed out, can anyone point it out please?!

Best Solution

I've worked out the solution, although it's not what's given in this article

I've replaced this line

<% render :file => 'layouts/application' %>


<%= render :file => 'layouts/application' %>

I'm not sure if the article is wrong, or I've found the wrong way to fix it! Please let me know!