From b9237e74e2843263cfe5df7d3f4a43f5f76a3293 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Thu, 21 Nov 2024 15:47:12 -0600 Subject: [PATCH 1/2] Require time zone core_ext instead of class We use Time.zone, which is a core extension. If it isn't loaded, we may not be able to access the zone correctly. --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index f189a70..8d6f77b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,7 +8,7 @@ require "app_profiler" require "active_support" -require "active_support/time_with_zone" +require "active_support/core_ext/time/zones" require "active_support/test_case" require "active_support/testing/autorun" From 0b35403a41efc2259bb4d1283d7a313d21e16335 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Mon, 10 Mar 2025 18:16:56 -0500 Subject: [PATCH 2/2] Move time extension require Depending on the state of the app, time zones may or may not be loaded at the time of profiling. This means we should require time zones support where we use it so that profiling will always work. This is specifically an issue for boot-time profiling. --- lib/app_profiler.rb | 1 + test/test_helper.rb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app_profiler.rb b/lib/app_profiler.rb index 8fa484d..2e68de9 100644 --- a/lib/app_profiler.rb +++ b/lib/app_profiler.rb @@ -3,6 +3,7 @@ require "active_support" require "active_support/core_ext/class" require "active_support/core_ext/module" +require "active_support/core_ext/time/zones" require "logger" require "app_profiler/version" diff --git a/test/test_helper.rb b/test/test_helper.rb index 8d6f77b..e60df4a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,7 +8,6 @@ require "app_profiler" require "active_support" -require "active_support/core_ext/time/zones" require "active_support/test_case" require "active_support/testing/autorun"