Skip to content

Commit 8be777b

Browse files
committed
Address ApplicationTests::QueryLogsTest errors
This commit addresses the following test errors since rails#52392 ```ruby $ bin/test test/application/query_logs_test.rb:271 Run options: --seed 33207 E Error: ApplicationTests::QueryLogsTest#test_controller_and_namespaced_controller_are_named_correctly,_legacy: NoMethodError: undefined method `update_formatter' for module ActiveRecord::QueryLogs /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/railtie.rb:403:in `block (2 levels) in <class:Railtie>' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/lazy_load_hooks.rb:94:in `block in execute_hook' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_control' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/lazy_load_hooks.rb:78:in `block in run_load_hooks' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/lazy_load_hooks.rb:77:in `each' /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/lazy_load_hooks.rb:77:in `run_load_hooks' lib/rails/application/finisher.rb:94:in `block in <module:Finisher>' lib/rails/initializable.rb:32:in `instance_exec' lib/rails/initializable.rb:32:in `run' lib/rails/initializable.rb:61:in `block in run_initializers' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `each' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `call' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each' lib/rails/initializable.rb:60:in `run_initializers' lib/rails/application.rb:428:in `initialize!' /home/yahonda/src/github.com/rails/rails/tmp/d20240723-41340-lvtci5/app/config/environment.rb:5:in `<top (required)>' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `require' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' /home/yahonda/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in `require' test/application/query_logs_test.rb:291:in `boot_app' test/application/query_logs_test.rb:276:in `block in <class:QueryLogsTest>' bin/test test/application/query_logs_test.rb:271 Finished in 4.038127s, 0.2476 runs/s, 0.0000 assertions/s. 1 runs, 0 assertions, 0 failures, 1 errors, 0 skips $ ```
1 parent 0fbf310 commit 8be777b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

activerecord/lib/active_record/railtie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ class Railtie < Rails::Railtie # :nodoc:
400400
end
401401

402402
if app.config.active_record.query_log_tags_format
403-
ActiveRecord::QueryLogs.update_formatter(app.config.active_record.query_log_tags_format)
403+
ActiveRecord::QueryLogs.tags_formatter = app.config.active_record.query_log_tags_format
404404
end
405405

406406
if app.config.active_record.cache_query_log_tags

railties/test/application/query_logs_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ def app
277277

278278
get "/", {}, { "HTTPS" => "on" }
279279
comment = last_response.body.strip
280-
assert_equal %(/*action:index,namespaced_controller:users,controller:users*/), comment
280+
assert_match %(/*action:index,controller:users,namespaced_controller:users*/), comment
281281

282282
get "/namespaced/users", {}, { "HTTPS" => "on" }
283283
comment = last_response.body.strip
284-
assert_equal %(/*action:index,namespaced_controller:name_spaced/users,controller:users*/), comment
284+
assert_match %(/*action:index,controller:users,namespaced_controller:name_spaced/users*/), comment
285285
end
286286

287287
private

0 commit comments

Comments
 (0)