Class: Eaco::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/eaco/railtie.rb

Overview

Initializer for Rails 3 and up.

  • Parses the configuration rules upon startup and, in development, after a console reload!.

  • Installs Controller authorization filters in ActionController::Base.

Instance Method Summary collapse

Instance Method Details

#install_controller_runtimeObject

Adds Controller to ActionController::Base


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/eaco/railtie.rb', line 39

initializer 'eaco.install_controller_runtime' do
  # :nocov:
  ActiveSupport.on_load :action_controller do

    ActionController::Base.instance_eval do
      include Eaco::Controller
    end

  end
  # :nocov:
end

#parse_rulesObject


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/eaco/railtie.rb', line 20

initializer 'eaco.parse_rules' do
  # :nocov:
  Eaco.parse_default_rules_file!

  unless Rails.configuration.cache_classes
    if defined? ActiveSupport::Reloader
      ActiveSupport::Reloader.to_prepare { Eaco.parse_default_rules_file! }
    else
      ActionDispatch::Reloader.to_prepare { Eaco.parse_default_rules_file! }
    end
  end
  # :nocov:
end