Inserting Headers and Footers in Ruby on Rails web application?

In the new_app/views/layouts there will be a file called application.html.erb. Open that file and put your header content above where it is written <%= yield> and footer content below <%=yield>.

I usually make a parital in layouts file called _header.html.erb and _footer.html.erb and do something like this :-

<%= render "layouts/header" %>
<%=yield %>
<%= render "layouts/footer" %>

Leave a Comment