1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove deprecated option :spec_name in the configs_for method

This commit is contained in:
Rafael Mendonça França 2021-11-16 15:18:08 -05:00
parent 5eddf5e9b4
commit 99b54b6ded
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
4 changed files with 7 additions and 14 deletions

View file

@ -1,3 +1,7 @@
* Remove deprecated option `:spec_name` in the `configs_for` method.
*Rafael Mendonça França*
* Remove deprecated `ActiveRecord::Base.allow_unsafe_raw_sql`.
*Rafael Mendonça França*

View file

@ -41,12 +41,7 @@ module ActiveRecord
# hidden by +database_tasks: false+ in the returned list. Most of the time we're only
# iterating over the primary connections (i.e. migrations don't need to run for the
# write and read connection). Defaults to +false+.
def configs_for(env_name: nil, spec_name: nil, name: nil, include_replicas: false, include_hidden: false)
if spec_name
name = spec_name
ActiveSupport::Deprecation.warn("The kwarg `spec_name` is deprecated in favor of `name`. `spec_name` will be removed in Rails 7.0")
end
def configs_for(env_name: nil, name: nil, include_replicas: false, include_hidden: false)
if include_replicas
include_hidden = include_replicas
ActiveSupport::Deprecation.warn("The kwarg `include_replicas` is deprecated in favor of `include_hidden`. When `include_hidden` is passed, configurations with `replica: true` or `database_tasks: false` will be returned. `include_replicas` will be removed in Rails 7.1.")

View file

@ -127,14 +127,6 @@ class LegacyDatabaseConfigurationsTest < ActiveRecord::TestCase
end
end
def test_spec_name_in_configs_for_is_deprecated
assert_deprecated do
db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", spec_name: "primary")
assert_equal "primary", db_config.name
end
end
def test_spec_name_getter_is_deprecated
db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary")

View file

@ -102,6 +102,8 @@ Please refer to the [Changelog][active-record] for detailed changes.
* Remove deprecated `ActiveRecord::Base.allow_unsafe_raw_sql`.
* Remove deprecated option `:spec_name` in the `configs_for` method.
### Deprecations
### Notable changes