Skip to content

Commit

Permalink
Fix Rails 7.1 compatibility by ensuring active_support is required be…
Browse files Browse the repository at this point in the history
…fore railtie

Not sure if this is us, strictly speaking but we seem to need to require active_support before the railties or the issue at rails/rails#49495 (comment) occurs

Since we do reference loggers here, seems appropriate for us to require ourselves.
  • Loading branch information
chadlwilson committed Jan 23, 2025
1 parent f52da2e commit 638c232
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/main/ruby/jruby/rack/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# See the file LICENSE.txt for details.
#++

require 'active_support'
require 'rails/railtie'
require 'pathname'

Expand Down Expand Up @@ -42,17 +43,7 @@ class Railtie < ::Rails::Railtie
logger.level = logger.class.const_get(log_level.to_s.upcase)
log_formatter = config.log_formatter if config.respond_to?(:log_formatter) # >= 4.0
logger.formatter = log_formatter if log_formatter && logger.respond_to?(:formatter=)
if defined?(ActiveSupport::TaggedLogging)
if ActiveSupport::TaggedLogging.is_a?(Class) # Rails 3.2
logger = ActiveSupport::TaggedLogging.new(logger)
else # Rails 4.0
# extends the logger as well as it's logger.formatter instance :
# NOTE: good idea to keep or should we use a clone as Rails.logger ?
#dup_logger = logger.dup
#dup_logger.formatter = logger.formatter.dup
logger = ActiveSupport::TaggedLogging.new(logger)
end
end
logger = ActiveSupport::TaggedLogging.new(logger)
logger
end
end
Expand Down
9 changes: 9 additions & 0 deletions src/spec/ruby/rails3x/stub/active_support.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#--
# Copyright (c) 2010-2012 Engine Yard, Inc.
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
# This source code is available under the MIT license.
# See the file LICENSE.txt for details.
#++

module ActiveSupport
end

0 comments on commit 638c232

Please sign in to comment.