On my non-high_voltage pages, I’m useing the following code to add an “active” class to the navigation element if the user is on the page: <li class="<%= 'active' if params[:controller] == 'home' %>"><a href="/">Home</a></li>
What is the equivalent way of doing it for my high_voltage pages (I want the active class on the li)?
<li class="nav-item"><%= link_to 'Plans', page_path("plans") %></li>
I ended up with this:
High voltage provides the
page_pathmethod to link to pages. I can use that to determine if I am on that page or not just like I do with the controller.