File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed
lib/rom/rails/active_record Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,17 @@ def call
4040 specs = { }
4141
4242 configurations . configs_for ( env_name : env ) . each do |config |
43- name = config . respond_to? ( :spec_name ) ? config . spec_name : config . name
44- hash = config . respond_to? ( :configuration_hash ) ? config . configuration_hash : config . config
43+ if config . respond_to? ( :configuration_hash )
44+ name , hash = [ config . name , config . configuration_hash ]
45+ else # Rails 6.0
46+ name , hash = [ config . spec_name , config . config ]
47+ end
4548
46- specs [ :default ] ||= build ( hash . symbolize_keys )
47- specs [ name . to_sym ] = build ( hash . symbolize_keys )
49+ specs [ :default ] ||= hash
50+ specs [ name . to_sym ] = hash
4851 end
4952
50- specs
53+ specs . transform_values { | hash | build hash . symbolize_keys }
5154 end
5255
5356 # Builds a configuration hash from a flat database config hash.
@@ -71,16 +74,6 @@ def build(config)
7174 uri = uri_builder . build ( adapter , uri_options )
7275 { uri : uri , options : other_options }
7376 end
74-
75- private
76-
77- def rails7?
78- ::ActiveRecord ::VERSION ::MAJOR == 7
79- end
80-
81- def rails6?
82- ::ActiveRecord ::VERSION ::MAJOR == 6
83- end
8477 end
8578 end
8679 end
You can’t perform that action at this time.
0 commit comments