Skip to content

Commit 73605a2

Browse files
committed
Remove deprecated ActiveRecord::Base.configurations.default_hash.
1 parent eeb9c78 commit 73605a2

File tree

4 files changed

+6
-24
lines changed

4 files changed

+6
-24
lines changed

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated `ActiveRecord::Base.configurations.default_hash`.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `ActiveRecord::Base.arel_attribute`.
26

37
*Rafael Mendonça França*

activerecord/lib/active_record/database_configurations.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,6 @@ def configs_for(env_name: nil, name: nil, include_replicas: false, include_hidde
6565
end
6666
end
6767

68-
# Returns the config hash that corresponds with the environment
69-
#
70-
# If the application has multiple databases +default_hash+ will
71-
# return the first config hash for the environment.
72-
#
73-
# { database: "my_db", adapter: "mysql2" }
74-
def default_hash(env = default_env)
75-
default = find_db_config(env)
76-
default.configuration_hash if default
77-
end
78-
alias :[] :default_hash
79-
deprecate "[]": "Use configs_for", default_hash: "Use configs_for"
80-
8168
# Returns a single DatabaseConfig object based on the requested environment.
8269
#
8370
# If the application has multiple databases +find_db_config+ will return

activerecord/test/cases/database_configurations_test.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ def test_configs_for_getter_with_env_and_name
4343
assert_equal "primary", config.name
4444
end
4545

46-
def test_default_hash_returns_config_hash_from_default_env
47-
original_rails_env = ENV["RAILS_ENV"]
48-
ENV["RAILS_ENV"] = "arunit"
49-
50-
assert_deprecated do
51-
assert_equal ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary").configuration_hash, ActiveRecord::Base.configurations.default_hash
52-
end
53-
ensure
54-
ENV["RAILS_ENV"] = original_rails_env
55-
end
56-
5746
def test_find_db_config_returns_first_config_for_env
5847
config = ActiveRecord::DatabaseConfigurations.new({
5948
"test" => {

guides/source/7_0_release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ Please refer to the [Changelog][active-job] for detailed changes.
258258

259259
* Remove deprecated `ActiveRecord::Base.arel_attribute`.
260260

261+
* Remove deprecated `ActiveRecord::Base.configurations.default_hash`.
262+
261263
### Deprecations
262264

263265
* Deprecated `Rails.config.active_job.skip_after_callbacks_if_terminated`.

0 commit comments

Comments
 (0)