aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-07-21 12:57:05 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-07-21 12:57:05 -0700
commit1a0b7ea3c903493dc44b2fd650cd8e7f3b234e46 (patch)
treed993a48b4c3d94389d3d8d00afe1afc913c4e68e /activerecord/lib/active_record/connection_adapters
parentf4ed9751251b2e979ee7bf38faf74371e78bbf42 (diff)
downloadrails-1a0b7ea3c903493dc44b2fd650cd8e7f3b234e46.tar.gz
rails-1a0b7ea3c903493dc44b2fd650cd8e7f3b234e46.tar.bz2
rails-1a0b7ea3c903493dc44b2fd650cd8e7f3b234e46.zip
adding more tests around database uri parsing
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
index ca83173d3a..ab07253e86 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
@@ -89,8 +89,8 @@ module ActiveRecord
end
end
- def self.connection_url_to_hash(url)
- config = URI.parse(url)
+ def self.connection_url_to_hash(url) # :nodoc:
+ config = URI.parse url
adapter = config.scheme
adapter = "postgresql" if adapter == "postgres"
spec = { :adapter => adapter,
@@ -99,14 +99,12 @@ module ActiveRecord
:port => config.port,
:database => config.path.sub(%r{^/},""),
:host => config.host }
- spec.reject!{ |key,value| value.nil? }
+ spec.reject!{ |_,value| !value }
if config.query
options = Hash[config.query.split("&").map{ |pair| pair.split("=") }].symbolize_keys
spec.merge!(options)
end
spec
- rescue URI::InvalidURIError
- return nil
end
class << self