Module: PhcdevworksActiveMenus::ApplicationHelper

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

Instance Method Summary collapse

Instance Method Details

#phc_menu_active_action(action_name) ⇒ Object

Add Active to Menu Based on Controller Name



10
11
12
# File 'app/helpers/phcdevworks_active_menus/application_helper.rb', line 10

def phc_menu_active_action(action_name)
  params[:action] == action_name ? "active" : nil
end

#phc_menu_active_action_controller(controller_name, action_name) ⇒ Object

Add Active to Menu Based on Both Controller Name and Action



15
16
17
# File 'app/helpers/phcdevworks_active_menus/application_helper.rb', line 15

def phc_menu_active_action_controller(controller_name, action_name)
  params[:controller] == controller_name && params[:action] == action_name ? "active" : nil
end

#phc_menu_active_controller(controller_name) ⇒ Object

Add Active to Menu Based on Controller Name



5
6
7
# File 'app/helpers/phcdevworks_active_menus/application_helper.rb', line 5

def phc_menu_active_controller(controller_name)
  params[:controller] == controller_name ? "active" : nil
end