Sha256: aea999acbabda095d73bcda2f6ac71258bd1ca0f2efe772f3f040e7f9019e466
Contents?: true
Size: 869 Bytes
Versions: 10
Compression:
Stored size: 869 Bytes
Contents
module Ahoy class Engine < ::Rails::Engine initializer "ahoy.middleware", after: "sprockets.environment" do |app| if Ahoy.throttle require "ahoy/throttle" app.middleware.use Ahoy::Throttle end next unless Ahoy.quiet # Parse PATH_INFO by assets prefix AHOY_PREFIX = "/ahoy/".freeze # Just create an alias for call in middleware Rails::Rack::Logger.class_eval do def call_with_quiet_ahoy(env) if env["PATH_INFO"].start_with?(AHOY_PREFIX) && logger.respond_to?(:silence_logger) logger.silence_logger do call_without_quiet_ahoy(env) end else call_without_quiet_ahoy(env) end end alias_method :call_without_quiet_ahoy, :call alias_method :call, :call_with_quiet_ahoy end end end end
Version data entries
10 entries across 10 versions & 1 rubygems