I am setting up my navbar link_to
's and I'm trying to stop a link being rendered if current_path is the same as link_path or if current path is the same as root path, as root path is defined as that same as the link path, as below:
_navbarhtml.erb
<ul class="nav navbar-nav navbar-right">
<% if user_signed_in? %>
<li><%= link_to_unless_current('My Quotes', quotes_path(current_user)) do %></li>
<% end %>
<li><%= link_to_unless_current('New Quote', new_quote_path) do %></li>
<% end %>
<li><%= link_to('My Account', edit_user_registration_path) %></li>
<li><%= link_to "Sign out", destroy_user_session_path, :method => :delete %></li>
<% else %>
<li><%= link_to('Sign in', new_user_session_path) %></li>
<li><%= link_to('Sign up', new_user_registration_path) %></li>
<% end %>
</li>
routes.rb
root 'quotes#new'
Any neat suggestions as to how to nicely write this?