Sha256: 457cafa08a4be2419e567ee5131ebf3e8a9718bf4f3af719d1b964c9d4e62928

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# Include ApplicationHelper into all controllers:
Mack.logger.debug "Initializing helpers..." unless app_config.log.disable_initialization_logging
# adding application_helper module into all defined controllers
if Object.const_defined?("ApplicationHelper")
  deprecate_method("ApplicationHelper", "Mack::ViewHelpers::ApplicationHelper", "0.7.0")
  ApplicationHelper.include_safely_into(Mack::Rendering::ViewTemplate)
end

module Mack
  module ControllerHelpers # :nodoc:
  end
  
  module ViewHelpers # :nodoc:
  end
end

# Find controller level Helpers and include them into their respective controllers
Mack::ControllerHelpers.constants.each do |cont|
  h = "Mack::ControllerHelpers::#{cont}"
  if Object.const_defined?(cont)
    h.constantize.include_safely_into(cont.constantize)
  else
    Mack.logger.warn("Could not find: #{cont} controller for helper: #{h}")
  end
end

# Find view level Helpers and include them into the Mack::Rendering::ViewTemplate
Mack::ViewHelpers.constants.each do |cont|
  h = "Mack::ViewHelpers::#{cont}".constantize
  Mack::Rendering::ViewTemplate.send(:include, h)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mack-0.7.0.1 lib/mack/initialization/helpers.rb
mack-0.7.0 lib/mack/initialization/helpers.rb