Really you should just get rid of the "main.html.erb" file. I don't see any reason for you to need that. (Perhaps you can explain what the purpose behind main.html.erb is?)
If you want a default layout for your entire application you need to use application.html.erb. It will need to look something like this:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><%= h(yield(:title) || "Untitled") %></title>
<%= stylesheet_link_tag 'application' %>
<%= javascript_include_tag :defaults %>
<%= yield(:head) %>
</head>
<body>
<div id="container">
<div id="header"><h1>Roundtable</h1></div>
<div id="wrapper">
<div id="content">
<%- flash.each do |name, msg| -%>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<%- end -%>
<%- if show_title? -%>
<h1><%=h yield(:title) %></h1>
<%- end -%>
<%= yield %>
</div>
</div>
<div id="navigation">
<strong>Navigation</strong>
</div>
<div id="footer">Footer.</div>
</div>
</body>
</html>
There are a few things that you need to note here:
First, you can include the stylesheet, javascript, or any other necessities right here and then you do not have to worry about them again.
Second, this is where you can implement "the flash" for passing messages from controllers.
Third, you use <%= yield %> where you want the content of your controllers to be displayed. For now, ignore the other yield tags that I have in this example.
Fourth, your views for your controllers will look something like the following:
Code:
<% for movie in @movies %>
<h3><%=h movie.title %></h3>
<p>
<%=h movie.description %>
</p>
<% end %>
That code will be inserted into the application.html.erb and the page will be rendered to the browser.
Designing your app like this may save you some frustrations. Hope this helps.
Bookmarks