diff options
author | Arthur Neves <arthurnn@gmail.com> | 2016-05-24 23:57:43 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2016-05-24 23:57:43 -0400 |
commit | 779ccf8a0e6a8bf7bb362c30dac4a340599ab113 (patch) | |
tree | 6ba707f5fca16144290128c4a3eb386ca6a6968c /activerecord/lib/active_record/connection_handling.rb | |
parent | 5167b8f7ffa66c8772c455916b8418844e3b4674 (diff) | |
download | rails-779ccf8a0e6a8bf7bb362c30dac4a340599ab113.tar.gz rails-779ccf8a0e6a8bf7bb362c30dac4a340599ab113.tar.bz2 rails-779ccf8a0e6a8bf7bb362c30dac4a340599ab113.zip |
Remove `name` from `establish_connection`
Instead of passing a separete name variable, we can make the resolver
merge a name on the config, and use that before creating the Specification.
Diffstat (limited to 'activerecord/lib/active_record/connection_handling.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_handling.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index b3fd837abe..086c678af5 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -50,7 +50,12 @@ module ActiveRecord config ||= DEFAULT_ENV.call.to_sym spec_name = self == Base ? "primary" : name self.connection_specification_name = spec_name - connection_handler.establish_connection(config, name: spec_name) + + resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(Base.configurations) + spec = resolver.resolve(config).symbolize_keys + spec[:name] = spec_name + + connection_handler.establish_connection(spec) end class MergeAndResolveDefaultUrlConfig # :nodoc: |