Sha256: 5dd83daedaadcec2aca2bbd1e1255b8bc91d4758cde6ab3f702cd7c203de97ea

Contents?: true

Size: 1.41 KB

Versions: 58

Compression:

Stored size: 1.41 KB

Contents

require "action_view"
require "rails"

module ActionView
  # = Action View Railtie
  class Railtie < Rails::Railtie
    config.action_view = ActiveSupport::OrderedOptions.new
    config.action_view.stylesheet_expansions = {}
    config.action_view.javascript_expansions = { :defaults => %w(jquery jquery_ujs) }

    initializer "action_view.cache_asset_ids" do |app|
      unless app.config.cache_classes
        ActiveSupport.on_load(:action_view) do
          ActionView::Helpers::AssetTagHelper::AssetPaths.cache_asset_ids = false
        end
      end
    end

    initializer "action_view.javascript_expansions" do |app|
      ActiveSupport.on_load(:action_view) do
        ActionView::Helpers::AssetTagHelper.register_javascript_expansion(
          app.config.action_view.delete(:javascript_expansions)
        )

        ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion(
          app.config.action_view.delete(:stylesheet_expansions)
        )
      end
    end

    initializer "action_view.set_configs" do |app|
      ActiveSupport.on_load(:action_view) do
        app.config.action_view.each do |k,v|
          send "#{k}=", v
        end
      end
    end

    initializer "action_view.caching" do |app|
      ActiveSupport.on_load(:action_view) do
        if app.config.action_view.cache_template_loading.nil?
          ActionView::Resolver.caching = app.config.cache_classes
        end
      end
    end
  end
end

Version data entries

58 entries across 53 versions & 2 rubygems

Version Path
challah-0.5.2 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.5.1 vendor/bundle/gems/actionpack-3.2.2/lib/action_view/railtie.rb
actionpack-3.2.2 lib/action_view/railtie.rb
actionpack-3.1.4 lib/action_view/railtie.rb
actionpack-3.2.2.rc1 lib/action_view/railtie.rb
actionpack-3.1.4.rc1 lib/action_view/railtie.rb
challah-0.5.0 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.4.1 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.4.0 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.3.5 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.3.4 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.3.3 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.3.2 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.3.1 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.3.0 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.2.1 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
challah-0.2.0 vendor/bundle/gems/actionpack-3.2.1/lib/action_view/railtie.rb
actionpack-3.2.1 lib/action_view/railtie.rb
actionpack-3.2.0 lib/action_view/railtie.rb
actionpack-3.2.0.rc2 lib/action_view/railtie.rb