From e78df08d13e3a744c0c826c4cc2770b91e9de725 Mon Sep 17 00:00:00 2001 From: Travis Brack Date: Tue, 22 May 2018 17:01:54 -0400 Subject: [PATCH] update middleware loading target for rails 5 Logic from https://github.com/ericallam/font_assets/pull/53 --- lib/font_assets/railtie.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/font_assets/railtie.rb b/lib/font_assets/railtie.rb index fbd507b..20e2887 100644 --- a/lib/font_assets/railtie.rb +++ b/lib/font_assets/railtie.rb @@ -8,7 +8,8 @@ class Railtie < Rails::Railtie config.font_assets.origin ||= "*" config.font_assets.options ||= { allow_ssl: true } - insert_target = if defined?(ActionDispatch::Static) + middleware_operations = app.middleware.instance_variable_get(:@operations) + insert_target = if defined?(ActionDispatch::Static) && middleware_operations.flatten.map(&:to_s).include?('ActionDispatch::Static') ActionDispatch::Static else Rack::Runtime