Jeff Burghess
Jeff Burghess

Reputation: 383

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?

Upvotes: 1

Views: 1178

Answers (1)

Abid Iqbal
Abid Iqbal

Reputation: 773

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%>

Upvotes: 3

Related Questions