在Ruby上的Ruby(5((5(您如何在仍在使用Application.html.erb的特定页面上保持NAV链接以保持导航链接?
例如:
application.html.erb
<nav class="nav">
<li><%= link_to "Home", root_path, :class => 'na' %></li>
<li><%= link_to "Units", units_path, :class => 'ACTIVE' %></li>
</nav>
也许很简单:
<%= link_to 'Units', units_path, class: "#{'active' if controller_name == 'units' && action_name == 'index'}" %>