Search code examples
htmlruby-on-railsrubyyield

How to ignore yield in html?


I created an html page but I do not want the header and footer to show. How would I do this?

<body>

    <div id="wrapper">  
        <%= render "layouts/header" %>
        <div id="inside"><%= yield %></div>
        <%= render "layouts/footer" %>
    </div>

</body>

Solution

  • Add "render :layout => false" to your controller, like this:

    class HomeController < AppliationController
      def index
        render :layout => false
      end
    end
    

    See this guide for more information on layouts/rendering: http://guides.rubyonrails.org/layouts_and_rendering.html