Module: OkonomiUiKit::ApplicationHelper

Defined in:
app/helpers/okonomi_ui_kit/application_helper.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
# File 'app/helpers/okonomi_ui_kit/application_helper.rb', line 3

def active_link_to(path, options = {}, &block)
  path_to_check = path.split("?").first
  if (options[:exact] && request.path == path_to_check) || (!options[:exact] && request.path.include?(path_to_check))
    options[:class] = options[:active_class].presence || [ options[:class], "active" ].compact.join(" ")
  end

  link_to(path, options, &block)
end