From e7bca1c8535f0bdcde6293a560d87a452265d2c3 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 17 Sep 2015 14:22:43 +0200 Subject: Check current_controller against controller_path The controller_path includes namespaces, where controller_name only includes the class name without controller --- app/helpers/application_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b049bd9fcc2..39ab83ccf12 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,7 +13,9 @@ module ApplicationHelper # current_controller?(:commits) # => false # current_controller?(:commits, :tree) # => true def current_controller?(*args) - args.any? { |v| v.to_s.downcase == controller.controller_name } + args.any? do |v| + v.to_s.downcase == controller.controller_name || v.to_s.downcase == controller.controller_path + end end # Check if a particular action is the current one -- cgit v1.2.3