Reputation: 3947
What I would like to do is to not show the headder in my rails app if the user is on the home page. Right now, the header is rendered in this line in application.html.erb:
<%= render('layouts/header') %>
What I'd like to do is put a conditional so that this doesn't get rendered if I'm on the home page. I think it should be something like:
<%= render('layouts/header') if not @homepage %>
where I set @homepage to true in the controller for the homepage. Does this approach make sense within the rails framework?
Upvotes: 2
Views: 356
Reputation: 28312
There are a few ways to do this, the easiest is probably:
<%= render('layouts/header') unless params[:controller] == 'homepage' %>
Upvotes: 5