File tree Expand file tree Collapse file tree
lib/rails_semantic_logger/active_record Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,14 +7,14 @@ class << self
77 attr_reader :logger
88 end
99
10- # Rails 7.2 removed runtime from log subscribers
11- if Rails . version . to_f < 7.2
10+ # Rails 7.1 stopped using runtime in log subscribers
11+ if Rails . version . to_f < 7.1
1212 def self . runtime = ( value )
1313 ::ActiveRecord ::RuntimeRegistry . sql_runtime = value
1414 end
1515
1616 def self . runtime
17- ::ActiveRecord ::RuntimeRegistry . sql_runtime
17+ ::ActiveRecord ::RuntimeRegistry . sql_runtime ||= 0
1818 end
1919
2020 def self . reset_runtime
Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ class ActiveRecordTest < Minitest::Test
231231 describe "runtime=" do
232232 it "allow reads and writes to the runtime" do
233233 unless RailsSemanticLogger ::ActiveRecord ::LogSubscriber . respond_to? ( :runtime )
234- skip "runtime support ended with Rails v7.2 "
234+ skip "runtime support ended with Rails v7.1 "
235235 end
236236
237237 RailsSemanticLogger ::ActiveRecord ::LogSubscriber . runtime = 5.0
@@ -241,12 +241,12 @@ class ActiveRecordTest < Minitest::Test
241241
242242 it "write to the runtime" do
243243 unless RailsSemanticLogger ::ActiveRecord ::LogSubscriber . respond_to? ( :runtime )
244- skip "runtime support ended with Rails v7.2 "
244+ skip "runtime support ended with Rails v7.1 "
245245 end
246246
247247 initial_value = RailsSemanticLogger ::ActiveRecord ::LogSubscriber . runtime
248248 RailsSemanticLogger ::ActiveRecord ::LogSubscriber . runtime = initial_value + 5000.0
249- assert_equal RailsSemanticLogger ::ActiveRecord ::LogSubscriber . runtime , initial_value
249+ assert_equal RailsSemanticLogger ::ActiveRecord ::LogSubscriber . runtime , initial_value + 5000.0
250250 end
251251 end
252252 end
You can’t perform that action at this time.
0 commit comments