From fd70daada8eeda6757ceb986770b943dfca29cf2 Mon Sep 17 00:00:00 2001 From: Takafumi ONAKA Date: Tue, 27 Feb 2024 04:55:13 +0900 Subject: [PATCH] Remove deprecation silence for connection.tables AR 5.0 introduced a warning, removed in AR 5.1. introduced: https://github.com/rails/rails/commit/7429633b82 removed: https://github.com/rails/rails/commit/5973a984c3 --- lib/database_rewinder.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/database_rewinder.rb b/lib/database_rewinder.rb index b674a7f..8770877 100644 --- a/lib/database_rewinder.rb +++ b/lib/database_rewinder.rb @@ -78,10 +78,10 @@ def all_table_names(connection) cache_key = get_cache_key(connection.pool) #NOTE connection.tables warns on AR 5 with some adapters tables = - if Rails.application.respond_to?(:deprecators) # AR >= 7.1 - Rails.application.deprecators.silence { connection.tables } - else + if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 0 ActiveSupport::Deprecation.silence { connection.tables } + else + connection.tables end schema_migraion_table_name = if ActiveRecord::SchemaMigration.respond_to?(:table_name)