Rails 高亮当前的菜单
Rails - Easy "active" classes for menu links in Rails
## app/helpers/application_helper.rb
module ApplicationHelper
def current_class?(test_path)
return "active" if request.path == test_path
""
end
end
## 添加到 html.erb 文件中
<a href="/" class="nav-link <%= current_class?('/') %>">