Reputation: 607
Hey I have a partial for a navigation bar in my rails project in my shared
folder. I want it to load the nav bar for everything except any of my views associated with my score
object. How can I write that condition out in the application.html.erb
file?
<div id="wrapper">
<%= render 'shared/navigation' if @some_condition %>
<%= yield %>
</div>
Thanks!
Upvotes: 0
Views: 422
Reputation: 2004
There is a current_page? helper in rails.
<% if current_page?(controller: 'score' action: 'show') %>
<!-- render somthing -->
<% else %>
<%= render 'shared/navigation' if @some_condition %>
<%= yield %>
<% end %>
Link to information http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-current_page-3F
Upvotes: 3