Reputation: 111
I have this in my layouts folder, filename application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>One Month Rails</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<% render 'layouts/header' %>
<%= yield %>
<% render 'layouts/footer' %>
</body>
</html>
I have this in my layouts folder, filename _header.html.erb
<%= link_to "Home", root_path %>
<%= link_to "About", about_path %>
After I save the code and refresh the page, the changes doesn't take place
Upvotes: 1
Views: 59
Reputation: 10208
You are trying to create a partial, thus you must rename to _header.html.erb
and change the .erb to <%= render 'layouts/header' %>
Please read the documentation about Using Partials in rails docs.
Upvotes: 2
Reputation: 4737
It looks like you need at least the following files:
/app/views/layouts/_header.html.erb
/app/views/layouts/_footer.html.erb
I assume you have the proper routes for root_path
and about_path
.
Upvotes: 0