Sha256: 2633849b64c3d57d846457031e138e0d998da7495bcd8e91ae5456fbec9fd5b5

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

module EffectiveAssets
  class Engine < ::Rails::Engine
    engine_name 'effective_assets'

    config.autoload_paths += Dir["#{config.root}/lib/validators/", "#{config.root}/lib/inputs/"]

    config.eager_load_paths += Dir["#{config.root}/lib/validators/", "#{config.root}/lib/inputs/"]

    # Include acts_as_addressable concern and allow any ActiveRecord object to call it
    initializer 'effective_assets.active_record' do |app|
      app.config.to_prepare do
        ActiveSupport.on_load :active_record do
          ActiveRecord::Base.extend(ActsAsAssetBox::ActiveRecord)
        end
      end
    end

    initializer 'effective_assets.action_view' do |app|
      app.config.to_prepare do
        ActiveSupport.on_load :action_view do
          ActionView::Helpers::FormBuilder.send(:include, AssetBoxFormInput)
        end
      end
    end

    # Set up our default configuration options.
    initializer "effective_assets.defaults", :before => :load_config_initializers do |app|
      eval File.read("#{config.root}/config/effective_assets.rb")
    end

    initializer "effective_assets.append_precompiled_assets" do |app|
      Rails.application.config.assets.precompile += [
        'effective_assets_manifest.js', 'effective_assets.js', 'effective_assets_iframe.js', 'effective_assets_iframe.css',
        'effective_assets/*', 'mime-types/*'
      ]
    end

    # ActiveAdmin (optional)
    # This prepends the load path so someone can override the assets.rb if they want.
    initializer 'effective_assets.active_admin' do
      if defined?(ActiveAdmin) && EffectiveAssets.use_active_admin == true
        ActiveAdmin.application.load_paths.unshift *Dir["#{config.root}/active_admin"]
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
effective_assets-1.12.2 lib/effective_assets/engine.rb
effective_assets-1.12.1 lib/effective_assets/engine.rb