Module: Binxtils::NavHelper

Defined in:
lib/binxtils/nav_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_page_active?(link_path, match_controller = false) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'lib/binxtils/nav_helper.rb', line 5

def current_page_active?(link_path, match_controller = false)
  return current_page?(link_path) unless match_controller

  Rails.application.routes.recognize_path(link_path)[:controller] == current_request_controller
rescue ActionController::RoutingError
  false
end