I’m getting the following error when Rails tries to render my layout located in app/views/layouts/application.html.erb:
Missing template shared/_header.erb in view path /home/me/checkout/site/app/views:
Extracted source (around line #11):
9: <div id="wrap">
10: <div class="clear">...</div>
11: <%= render :partial => 'shared/header' %>
What’s weird about all of this is that I have a directory named shared inside of app/views. Inside there I have a file named _header.html.erb.
I’m using Ruby 1.8.7, Rails
2.2.2, and following the documentation found here.
Update: Even more weirdness. This code works under Windows using InstantRails (Ruby 1.8.6, Rails 2.2.2). However, render :template doesn’t seem to work. I’ll keep on investigating.
If what you typed is correct, your partial is misnamed. It should be “_header.html.erb” and not “_header.erb.html”. This is probably why Rails is not finding it.
It has been quite a while since I have touched Rails 2.2, but I believe that you are looking for the following:
<%= render :template => 'shared/header' %>
Edit: To whoever else is down down voting this, try reading the 2.2.2 docs and actually trying it first. This was a big gotcha back then.