def current_link_to label, path
link_to label, path, class: (current_page?(path) ? "active" : nil)
end
def current_link_to label, path
from_path = controller._routes.recognize_path(path).values rescue nil
css = from_path & [controller_name, action_name] == from_path ? 'active' : nil
link_to label, path, class: css
end
No route matches {:action=>"index", :controller=>"welcome"}
Extracted source (around line #13):
10
%h1.logo Флайда
%ul.menu
%li
= current_link_to 'Главная', root_path
resources :services
root :to => 'welcome#hi'
get 'contacts' => 'welcome#contacts'