Sha256: b8810c514c4f2f73cb8067c37e72b0c1d3b4ec434ad809e61107bf1fd2c3edde

Contents?: true

Size: 1.66 KB

Versions: 20

Compression:

Stored size: 1.66 KB

Contents

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

    config.autoload_paths += Dir["#{config.root}/app/models/**/"]

    # Include Helpers to base application
    initializer 'effective_assets.action_controller' do |app|
      ActiveSupport.on_load :action_controller do
        helper EffectiveAssetsHelper
        helper EffectiveAssetsS3Helper
      end
    end

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

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

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

    initializer "effective_assets.append_precompiled_assets" do |app|
      Rails.application.config.assets.precompile += ['effective_assets.js', 'effective_assets_iframe.js', 'effective_assets_iframe.css', 'spinner.gif']
    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

20 entries across 20 versions & 1 rubygems

Version Path
effective_assets-1.5.8 lib/effective_assets/engine.rb
effective_assets-1.5.7 lib/effective_assets/engine.rb
effective_assets-1.5.6 lib/effective_assets/engine.rb
effective_assets-1.5.5 lib/effective_assets/engine.rb
effective_assets-1.5.4 lib/effective_assets/engine.rb
effective_assets-1.5.3 lib/effective_assets/engine.rb
effective_assets-1.5.2 lib/effective_assets/engine.rb
effective_assets-1.5.1 lib/effective_assets/engine.rb
effective_assets-1.5.0 lib/effective_assets/engine.rb
effective_assets-1.4.9 lib/effective_assets/engine.rb
effective_assets-1.4.8 lib/effective_assets/engine.rb
effective_assets-1.4.7 lib/effective_assets/engine.rb
effective_assets-1.4.6 lib/effective_assets/engine.rb
effective_assets-1.4.5 lib/effective_assets/engine.rb
effective_assets-1.4.4 lib/effective_assets/engine.rb
effective_assets-1.4.3 lib/effective_assets/engine.rb
effective_assets-1.4.2 lib/effective_assets/engine.rb
effective_assets-1.4.1 lib/effective_assets/engine.rb
effective_assets-1.4.0 lib/effective_assets/engine.rb
effective_assets-1.3.2 lib/effective_assets/engine.rb