class Refinery::Core::Engine

Public Class Methods

refinery_inclusion!() click to toggle source

Performs the Refinery inclusion process which extends the currently loaded Rails applications with Refinery's controllers and helpers. The process is wrapped by a before_inclusion and after_inclusion step that calls procs registered by the Refinery::Engine#before_inclusion and Refinery::Engine#after_inclusion class methods

# File lib/refinery/core/engine.rb, line 14
def refinery_inclusion!
  before_inclusion_procs.each(&:call).tap do |c|
    c.clear if Rails.application.config.cache_classes
  end

  Refinery.include_once(::ApplicationController, Refinery::ApplicationController)
  ::ApplicationController.send :helper, Refinery::Core::Engine.helpers

  after_inclusion_procs.each(&:call).tap do |c|
    c.clear if Rails.application.config.cache_classes
  end

  # Register all decorators from app/decorators/ and registered plugins' paths.
  Decorators.register! Rails.root, Refinery::Plugins.registered.pathnames
end