Skip to content
This repository
Browse code

Index sprockets environment if perform caching is enabled

  • Loading branch information...
commit a4518517f77055cea0d9fe552d2df393140679de 1 parent ed24595
Joshua Peek authored
1  railties/lib/rails/application.rb
@@ -140,6 +140,7 @@ def config
140 140
     def assets
141 141
       @assets ||= build_asset_environment
142 142
     end
  143
+    attr_writer :assets
143 144
 
144 145
     def build_asset_environment
145 146
       return unless config.assets.enabled
6  railties/lib/rails/application/finisher.rb
@@ -48,6 +48,12 @@ module Finisher
48 48
         end
49 49
       end
50 50
 
  51
+      initializer :index_sprockets_environment do |app|
  52
+        if config.assets.enabled && config.action_controller.perform_caching
  53
+          app.assets = app.assets.index
  54
+        end
  55
+      end
  56
+
51 57
       initializer :build_middleware_stack do
52 58
         build_middleware_stack
53 59
       end

0 notes on commit a451851

Please sign in to comment.
Something went wrong with that request. Please try again.