Class: Refinery::Core::Engine

Inherits:
Rails::Engine
  • Object
show all
Extended by:
Engine
Defined in:
core/lib/refinery/core/engine.rb

Class Method Summary collapse

Methods included from Engine

after_inclusion, before_inclusion

Class Method Details

.refinery_inclusion!Object

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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'core/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