Right now I have a navigation partial that looks like this (x10 buttons)…
<% if current_controller == 'territories' %> <li><%= link_to 'Territories', {:controller => 'territories'}, :class => 'active' %></li> <% else %> <li><%= link_to 'Territories', {:controller => 'territories'} %></li> <% end %> <% if current_controller == 'contacts' %> <li><%= link_to 'Contacts', {:controller => 'Contacts'}, :class => 'active' %></li> <% else %> <li><%= link_to 'Contacts', {:controller => 'Contacts'} %></li> <% end %>
Is there a more elegant/DRY solution for doing this?
In a similar vein to what Chuck said: