Sorry for such a simple question, but I have not been able to solve it myself after a few hours since my RoR knowledge is mostly lacking. In the Rails application I'm working with, a navigation assistant was used to highlight the active menu:
def nav_link(link_text, link_path, ico_path)
class_name = current_page?(link_path) ? 'active' : nil
content_tag :li do
link_to(link_path, class: class_name) do
image_tag("icons/#{ico_path}.svg") + content_tag(:span, link_text)
end
end
end
Conditions have changed, and is current_page?no longer a viable option since routing is now handled on the interface. Is there a way to achieve the same functionality by extracting, for example, the current URL and checking it for link_path? I tried many things with the help of various helpers, such as request.original_url, but to no avail.
source
share