app/helpers/application_helper.rb
# Check if a particular namespace(module) of controller is the current one
#
# args - One or more module names to check
#
# Examples
#
#   # On Forest::TreeController
#   current_controller?(:forest)           # => true
#   current_controller?(:tree)        # => false
#   current_controller?(:forest, :wood) # => true
Check if a particular namespace(module) of controller is the current one
args - One or more module names to check

Examples


Check if a particular namespace ( module ) of controller is the current one args - One or more module names to check Examples
def content_data_page
    path = controller.controller_path.split('/')
    namespace = path.first if path.second
    [namespace, controller.controller_name, controller.action_name].compact.join('-')
  end
def content_data_page path = controller . controller_path . split ( '/' ) namespace = path . first if path . second [ namespace , controller . controller_name , controller . action_name ] . compact . join ( '-' ) end
Check if a particular namespace(module) of controller is the current one
args - One or more module names to check
Check if a particular namespace ( module ) of controller is the current one args - One or more module names to check