From ed95be1b6ae5ceb88030a7bdd56eee3a89eb98bd Mon Sep 17 00:00:00 2001 From: Manfred Stienstra Date: Mon, 13 Jul 2026 18:49:59 +0200 Subject: [PATCH 1/2] Use public method to query defined collations. Rails 8.2 is going to remove internal_exec_query and it's probably a good idea to use public methods in our code even though it hooks into Rails internals pretty deep. --- lib/active_record/collation/schema_statements.rb | 2 +- .../collation/schema_statements_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/active_record/collation/schema_statements.rb b/lib/active_record/collation/schema_statements.rb index c266e77..2f8fe85 100644 --- a/lib/active_record/collation/schema_statements.rb +++ b/lib/active_record/collation/schema_statements.rb @@ -18,7 +18,7 @@ def drop_collation(name) end def collations - internal_exec_query(collations_sql, 'SCHEMA') + select_all(collations_sql, 'SCHEMA') end private diff --git a/test/active_record/collation/schema_statements_test.rb b/test/active_record/collation/schema_statements_test.rb index 738cd8f..1733ef8 100644 --- a/test/active_record/collation/schema_statements_test.rb +++ b/test/active_record/collation/schema_statements_test.rb @@ -18,6 +18,20 @@ def collation_names ApplicationRecord.connection.drop_collation(:misc) assert_equal_set(%w[natural_de natural_en], collation_names) end + + test 'notifies internals about the executed queries' do + queries = [] + callback = ->(event) { queries << event.payload[:sql] } + + ActiveSupport::Notifications.subscribed(callback, 'sql.active_record') do + collation_names + end + + assert_includes( + queries.last, + "pg_namespace.nspname = 'public'" + ) + end end end end From 464306a58031a99015358fec427b8e87957262b2 Mon Sep 17 00:00:00 2001 From: Manfred Stienstra Date: Mon, 13 Jul 2026 18:56:31 +0200 Subject: [PATCH 2/2] Explain how to run tests on Edge. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index ba13411..f669437 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,18 @@ Arel::Nodes::InfixOperation.new( Run tests in this repository with `rake`. Migrations are exercised by running them in the dummy application. ``` +bundle install +cd test/dummy +rm -f db/schema.rb && RAILS_ENV=test bundle exec rake db:drop db:create db:migrate +cd ../../ +bundle exec rake +``` + +If you also want to verify running tests on Rails Edge, you can set `BUNDLE_GEMFILE` and run everything again. Otherwise could technically also rely on GitHub Actions to run this for you. + +``` +export BUNDLE_GEMFILE=$(pwd)/Gemfile.edge +bundle install cd test/dummy rm -f db/schema.rb && RAILS_ENV=test bundle exec rake db:drop db:create db:migrate cd ../../