Remove deprecated `DatabaseConfig#config` method

This commit is contained in:
Rafael Mendonça França 2021-11-17 22:41:10 +00:00
parent 15aa4200e0
commit 7b9d4d2d8a
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
5 changed files with 6 additions and 15 deletions

View File

@ -1,3 +1,7 @@
* Remove deprecated `DatabaseConfig#config` method.
*Rafael Mendonça França*
* Rollback transactions when the block returns earlier than expected.
Before this change, when a transaction block returned early, the transaction would be committed.

View File

@ -20,10 +20,6 @@ module ActiveRecord
end
deprecate spec_name: "please use name instead"
def config
raise NotImplementedError
end
def adapter_method
"#{adapter}_connection"
end

View File

@ -32,11 +32,6 @@ module ActiveRecord
@configuration_hash = configuration_hash.symbolize_keys.freeze
end
def config
ActiveSupport::Deprecation.warn("DatabaseConfig#config will be removed in 7.0.0 in favor of DatabaseConfig#configuration_hash which returns a hash with symbol keys")
configuration_hash.stringify_keys
end
# Determines whether a database configuration is for a replica / readonly
# connection. If the +replica+ key is present in the config, +replica?+ will
# return +true+.

View File

@ -115,12 +115,6 @@ class LegacyDatabaseConfigurationsTest < ActiveRecord::TestCase
end
end
def test_deprecated_config_method
db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary")
assert_equal db_config.configuration_hash.stringify_keys, assert_deprecated { db_config.config }
end
def test_unsupported_method_raises
assert_raises NoMethodError do
ActiveRecord::Base.configurations.fetch(:foo)

View File

@ -124,6 +124,8 @@ Please refer to the [Changelog][active-record] for detailed changes.
* Remove deprecated support to pass a column to `type_cast`.
* Remove deprecated `DatabaseConfig#config` method.
### Deprecations
### Notable changes