aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/connection_specification.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-04-09 11:03:10 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-04-09 11:03:10 -0700
commitdb5e578b647e1730ea2aecb1ca58fd9a434f6cf6 (patch)
tree524517ae1ffc1ec01af367d72a51a8323dee931b /activerecord/lib/active_record/connection_adapters/connection_specification.rb
parent3321d1a2d1908f25d962169d0a88b55bca3c2370 (diff)
parent7b75b678cf11a1aed7927a9db42fb60a38726450 (diff)
downloadrails-db5e578b647e1730ea2aecb1ca58fd9a434f6cf6.tar.gz
rails-db5e578b647e1730ea2aecb1ca58fd9a434f6cf6.tar.bz2
rails-db5e578b647e1730ea2aecb1ca58fd9a434f6cf6.zip
Merge branch 'master' into adequaterecord
* master: (26 commits) Avoid URI parsing Add missing require so requiring `active_support/cache` works again. depend_on_asset is not required anymore on sprockets-rails 2.1.2 upgrading section for 4.1 is no longer WIP. [ci skip] Expand explanation of how to set secrets.yml. [ci skip] Guides: minor typo fixed [ci skip] Fixed problem where `1.day.eql?(1.day)` is false new CHANGELOGs entries are in the top [ci skip] Updates the maintenance policy with new Rails versions Dont abbreviate that which needs no abbreviation Dont encourage aliases now that we have variants Use short-form for the scaffold render calls and drop the needless test Drop in @jeremy's new database.yml template text Don't deprecate after all Less ambition, more deprecation Ensure we correctly and immediately load all ENV entries Give a deprecation message even when the lookup fails Rearrange the config merger some more entry is always a Hash Check env_url only once ... Conflicts: Gemfile
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/connection_specification.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/connection_specification.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb
index e0715f7ce9..a8ab52be74 100644
--- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb
+++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb
@@ -33,7 +33,7 @@ module ActiveRecord
def initialize(url)
raise "Database URL cannot be empty" if url.blank?
@uri = URI.parse(url)
- @adapter = @uri.scheme
+ @adapter = @uri.scheme.gsub('-', '_')
@adapter = "postgresql" if @adapter == "postgres"
if @uri.opaque
@@ -220,10 +220,10 @@ module ActiveRecord
# an environment key or a URL spec, so we have deprecated
# this ambiguous behaviour and in the future this function
# can be removed in favor of resolve_url_connection.
- if configurations.key?(spec)
+ if configurations.key?(spec) || spec !~ /:/
ActiveSupport::Deprecation.warn "Passing a string to ActiveRecord::Base.establish_connection " \
"for a configuration lookup is deprecated, please pass a symbol (#{spec.to_sym.inspect}) instead"
- resolve_connection(configurations[spec])
+ resolve_symbol_connection(spec)
else
resolve_url_connection(spec)
end