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 s开发者_Python百科et @homepage to true in the controller for the homepage. Does this approach make sense within the rails framework?
There are a few ways to do this, the easiest is probably:
<%= render('layouts/header') unless params[:controller] == 'homepage' %>
精彩评论