From f09e53f3fb5a29c83f9dc214a87c6581176f80bc Mon Sep 17 00:00:00 2001 From: Kai Aihara Date: Thu, 25 Oct 2018 21:05:20 +0900 Subject: [PATCH] Bug revise of monkey patch without Rails gem such as rails-html-sanitizer gem uses Rails constant without rails gem ref. https://github.com/rails/rails-html-sanitizer/blob/master/lib/rails/html/sanitizer.rb#L1 --- lib/zipkin-tracer/application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/zipkin-tracer/application.rb b/lib/zipkin-tracer/application.rb index cdb7aba..d62b0ae 100644 --- a/lib/zipkin-tracer/application.rb +++ b/lib/zipkin-tracer/application.rb @@ -4,7 +4,7 @@ module ZipkinTracer class Application # If the request is not valid for this service, we do not what to trace it. def self.routable_request?(path_info, http_method) - return true unless defined?(Rails) # If not running on a Rails app, we can't verify if it is invalid + return true unless defined?(Rails.application) # If not running on a Rails app, we can't verify if it is invalid Rails.application.routes.recognize_path(path_info, method: http_method) true rescue ActionController::RoutingError @@ -12,7 +12,7 @@ def self.routable_request?(path_info, http_method) end def self.get_route(env) - return nil unless defined?(Rails) + return nil unless defined?(Rails.application) req = Rack::Request.new(env) # Returns a string like /some/path/:id Rails.application.routes.router.recognize(req) do |route|