Wesly
Wesly

Reputation: 343

How can i only show the header on some pages and not all of them

I have a _header.html.erb rendering in all my pages from layouts/applications. Is there a way that i can not make it show on some pages? For example i would like the header not to show in example.com/videos/1.

Upvotes: 2

Views: 151

Answers (1)

Mischa
Mischa

Reputation: 43298

You can do this in your layout file:

<% unless @hide_header %>
   <%= render 'header' %>
<% end %>

And then set @hide_header = true in your controller if you want it to be hidden.

Upvotes: 3

Related Questions