lib/xray/middleware.rb in xray-rails-0.1.3 vs lib/xray/middleware.rb in xray-rails-0.1.4

- old
+ new

@@ -35,11 +35,14 @@ # Inject xray.js and friends if it's a plain ol' successful HTML request. else status, headers, response = @app.call(env) if should_inject_xray?(status, headers, response) body = response.body.sub(/<body[^>]*>/) { "#{$~}\n#{xray_bar}" } - append_js!(body, 'jquery', :xray) - append_js!(body, 'backbone', :'xray-backbone') + # Inject js script tags if assets are unbundled + if Rails.application.config.assets.debug + append_js!(body, 'jquery', :xray) + append_js!(body, 'backbone', :'xray-backbone') + end headers['Content-Length'] = body.bytesize.to_s end [status, headers, (body ? [body] : response)] end end