aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/railtie.rb
blob: c606a71e187339dec332549f1e14a38d3c498f16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require "action_view"
require "rails"

module ActionView
  class Railtie < Rails::Railtie
    config.action_view = ActiveSupport::OrderedOptions.new

    require "action_view/railties/log_subscriber"
    log_subscriber :action_view, ActionView::Railties::LogSubscriber.new

    initializer "action_view.cache_asset_timestamps" do |app|
      unless app.config.cache_classes
        ActiveSupport.on_load(:action_view) do
          ActionView::Helpers::AssetTagHelper.cache_asset_timestamps = false
        end
      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
  end
end