简体   繁体   中英

I have a partial in application.html.erb, how do I remove it on certain views?

In the body of application.html.erb I have:

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

On a certain view, I want to remove the footer partial, or otherwise have it not show up on the view. How should I do this?

You can set the condition below for rendering your partial.

<%= render 'layouts/header'%>
<%= yield %>
<% unless controller_name=="sessions" && action_name=='new' %>
  <%= render 'layouts/footer'%>
<%end%>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM