Sha256: 41509680a13e9d97d059c1f195275ea11505859135bdcd0165a8e9caf6d12962

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

module Light
  module Decorator
    class Railtie < Rails::Railtie
      config.after_initialize do |app|
        # Eager loading of Decorators classes
        app.config.paths.add 'app/decorators', eager_load: true
      end

      initializer 'light.decorator.inject_orm' do
        ActiveSupport.on_load :active_record do
          ActiveRecord::Base.send(:include, ::Light::Decorator::Concerns::Base)
          ActiveRecord::Relation.send(:include, ::Light::Decorator::Concerns::Relation)
          ActiveRecord::Associations::CollectionProxy.send(
            :include, ::Light::Decorator::Concerns::Associations::CollectionProxy
          )
        end
      end

      initializer 'light.decorator.load_view_context' do
        [:action_controller, :action_mailer].each do |action_module|
          ActiveSupport.on_load action_module do
            include ::Light::Decorator::ViewContext
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
light-decorator-0.5.3 lib/light/decorator/railtie.rb
light-decorator-0.5.2 lib/light/decorator/railtie.rb
light-decorator-0.5.1 lib/light/decorator/railtie.rb
light-decorator-0.5.0 lib/light/decorator/railtie.rb