Remove deprecated methods in ActiveRecord::Base

This commit is contained in:
Rafael Mendonça França 2023-10-12 21:49:54 +00:00
parent 7a08a86d21
commit 5515fa49a2
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
3 changed files with 25 additions and 28 deletions

View File

@ -1,3 +1,19 @@
* Remove deprecated `ActiveRecord::Base.clear_active_connections!`.
*Rafael Mendonça França*
* Remove deprecated `ActiveRecord::Base.clear_reloadable_connections!`.
*Rafael Mendonça França*
* Remove deprecated `ActiveRecord::Base.clear_all_connections!`.
*Rafael Mendonça França*
* Remove deprecated `ActiveRecord::Base.flush_idle_connections!`.
*Rafael Mendonça França*
* Remove deprecated `name` argument from `ActiveRecord::Base.remove_connection`.
*Rafael Mendonça França*

View File

@ -320,35 +320,7 @@ module ActiveRecord
connection_pool.schema_cache.clear!
end
def clear_active_connections!(role = nil)
deprecation_for_delegation(__method__)
connection_handler.clear_active_connections!(role)
end
def clear_reloadable_connections!(role = nil)
deprecation_for_delegation(__method__)
connection_handler.clear_reloadable_connections!(role)
end
def clear_all_connections!(role = nil)
deprecation_for_delegation(__method__)
connection_handler.clear_all_connections!(role)
end
def flush_idle_connections!(role = nil)
deprecation_for_delegation(__method__)
connection_handler.flush_idle_connections!(role)
end
private
def deprecation_for_delegation(method)
ActiveRecord.deprecator.warn(<<-MSG.squish)
Calling `ActiveRecord::Base.#{method} is deprecated. Please
call the method directly on the connection handler; for
example: `ActiveRecord::Base.connection_handler.#{method}`.
MSG
end
def resolve_config_for_connection(config_or_env)
raise "Anonymous class is not allowed." unless name

View File

@ -111,6 +111,15 @@ Please refer to the [Changelog][active-record] for detailed changes.
* Remove deprecated `name` argument from `ActiveRecord::Base.remove_connection`.
* Remove deprecated `ActiveRecord::Base.clear_active_connections!`.
* Remove deprecated `ActiveRecord::Base.clear_reloadable_connections!`.
* Remove deprecated `ActiveRecord::Base.clear_all_connections!`.
* Remove deprecated `ActiveRecord::Base.flush_idle_connections!`.
### Deprecations
### Notable changes