Skip to content

Commit 13e28f5

Browse files
committed
Fix error in deprecation
When I implemented the deprecation for rails#38536 I left in the setter in the initalizer. This meant that objects returned had both `@name` and `@spec_name` set and objects looked like this: ``` <ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fe0f7100c68 @env_name="development", @name="primary", @spec_name="primary", @config={ :adapter=>"mysql2", :database=>"recipes_app_development" } > ``` Since we don't use the kwarg to create the hash config and we have the reader for reading off the object or selecting from the configurations objects list we can remove this so the object looks like: ``` <ActiveRecord::DatabaseConfigurations::HashConfig:0x00007fe0f7100c68 @env_name="development", @name="primary", @config={ :adapter=>"mysql2", :database=>"recipes_app_development" } > ```
1 parent df74da0 commit 13e28f5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

activerecord/lib/active_record/database_configurations/database_config.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ class DatabaseConfigurations
66
# UrlConfig respectively. It will never return a DatabaseConfig object,
77
# as this is the parent class for the types of database configuration objects.
88
class DatabaseConfig # :nodoc:
9-
attr_reader :env_name, :name, :spec_name
10-
deprecate spec_name: "please use name instead"
9+
attr_reader :env_name, :name
1110

1211
attr_accessor :owner_name
1312

1413
def initialize(env_name, name)
1514
@env_name = env_name
1615
@name = name
17-
@spec_name = name
1816
end
1917

18+
def spec_name
19+
@name
20+
end
21+
deprecate spec_name: "please use name instead"
22+
2023
def config
2124
raise NotImplementedError
2225
end

0 commit comments

Comments
 (0)