I want to show a div for all pages except professors#show.
So I thought that I could put an unless statement in applicaiton.html.erb I started off with something like this:
<% unless current_page?(controller: "professors", action: "show") %>
<div class="center-block">
<% end %>
This works for the show action but when user navigates to another page the website crashes with this error:
No route matches {:action=>"show", :controller=>"professors"}
I realized by looking here and here that I needed additional params:
<% unless current_page?(controller: 'professors', action: 'show', id: @professor.id) %>
<div class="center-block ">
<% end %>
This again works when in the show action but crashes with this error on any other page:
undefined method `id' for nil:NilClass
I see what the problem is, I think, outside of professors#show @professor.id means nothing, but I'm not sure how to fix it. I'm not even sure if I'm going about this the right way, remember my end goal is to show the center-block div on all pages except for pages that are showing a specific professor.