Skip to content

Commit 48ae158

Browse files
committed
Change init order for sprockets-rails 3.0 compat.
It seems that sprockets-rails 3.0.0 does not initialize the `app.assets` object until it runs its `after_initialize` block. This means that xray-rails must move its initialization process into `after_initialize` as well. The exception is the `config.assets.precompile` modifications, which must be done earlier before that array gets frozen. These changes fix the "asset pipeline is currently disabled" error when starting up a Rails app that uses sprockets-rails 3.0.0.
1 parent dc51875 commit 48ae158

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/xray/engine.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ module Xray
77
# xray.js and the xray bar into the app's response bodies.
88
class Engine < ::Rails::Engine
99
initializer "xray.initialize" do |app|
10-
ensure_asset_pipeline_enabled! app
1110
app.middleware.use Xray::Middleware
1211

1312
# Required by Rails 4.1
1413
app.config.assets.precompile += %w(xray.js xray-backbone.js xray.css)
14+
end
15+
16+
config.after_initialize do |app|
17+
ensure_asset_pipeline_enabled! app
1518

1619
# Register as a Sprockets processor to augment JS files, including
1720
# compiled coffeescript, with filepath information. See

0 commit comments

Comments
 (0)