I had a similar challenge like you, but for mine I wanted my home page to have a slightly different header from the other pages.
Here's how I got it working:
All I had to do was to create 2 header partials in the app/views/shared
directory:
_home_header.html.erb
_other_header.html.erb
Then I referenced it this way in the app/views/layouts/application.html.erb
file:
<%= render partial: '/shared/home_header' if params[:controller] == 'homes' %>
<%= render partial: '/shared/other_header' if params[:controller] != 'homes' %>
It can also be referenced this way using an explicit if conditional:
<% if params[:controller] == 'homes' %>
<%= render partial: '/shared/home_header' %>
<% elsif params[:controller] != 'homes' %>
<%= render partial: '/shared/other_header' %>
<% else %>
<% end %>
Thank you steve klein for your comment that gave me an insight into this.
That's all.
I hope this helps