Skip to content

Commit f4822f0

Browse files
committed
💚 Paper over a bug in Rails v6/7 with require "logger"
Previously some gems masked a bug in Rails v6 and v7 where `logger` was not required, plugging the hole by requiring it themselves. Because this app is pinned to Rails v6.1, we must require logger manually. In order to not be reliant on other libraries to fix the bug in Rails for us, we do it too. See: https://stackoverflow.com/questions/79360526/uninitialized-constant-activesupportloggerthreadsafelevellogger-nameerror
1 parent 128aa4b commit f4822f0

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ source "https://rubygems.org"
88
# Uncomment this to use development version of html formatter from github
99
# gem "simplecov-html", github: "simplecov-ruby/simplecov-html"
1010

11-
# std lib gems removed from std lib
11+
# former std libs that have been ejected
1212
gem "logger"
13+
gem "ostruct"
1314

1415
gem "matrix"
1516

Gemfile.lock

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ GEM
9393
nokogiri (1.18.1)
9494
mini_portile2 (~> 2.8.2)
9595
racc (~> 1.4)
96+
ostruct (0.6.1)
9697
parallel (1.26.3)
9798
parser (3.3.6.0)
9899
ast (~> 2.4.1)
@@ -184,6 +185,7 @@ DEPENDENCIES
184185
logger
185186
matrix
186187
minitest
188+
ostruct
187189
pry
188190
rackup
189191
rake

test_projects/rails/rspec_rails/Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
source "https://rubygems.org"
44

55
# added gems
6+
# former std libs that have been ejected
7+
gem "logger"
8+
gem "ostruct"
69

710
gem "rspec-rails"
811
gem "simplecov", path: "../../.."
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
22

33
require "bundler/setup" # Set up gems listed in the Gemfile.
4+
5+
# Previously some gems masked a bug in Rails v6 and v7 where `logger` was not required,
6+
# plugging the hole by requiring it themselves.
7+
# Because this app is pinned to Rails v6.1, we must require logger manually.
8+
# In order to not be reliant on other libraries to fix the bug in Rails for us, we do it too.
9+
# See: https://stackoverflow.com/questions/79360526/uninitialized-constant-activesupportloggerthreadsafelevellogger-nameerror
10+
require "logger"

0 commit comments

Comments
 (0)