mirror of https://github.com/rails/rails
Merge pull request #23472 from jhubert/patch-2
Remove the assumption of schema in DATABASE_URL
This commit is contained in:
commit
22af61984c
|
@ -33,7 +33,7 @@ module ActiveRecord
|
|||
def initialize(url)
|
||||
raise "Database URL cannot be empty" if url.blank?
|
||||
@uri = uri_parser.parse(url)
|
||||
@adapter = @uri.scheme.tr('-', '_')
|
||||
@adapter = @uri.scheme && @uri.scheme.tr('-', '_')
|
||||
@adapter = "postgresql" if @adapter == "postgres"
|
||||
|
||||
if @uri.opaque
|
||||
|
|
|
@ -57,6 +57,12 @@ module ActiveRecord
|
|||
"encoding" => "utf8" }, spec)
|
||||
end
|
||||
|
||||
def test_url_missing_scheme
|
||||
spec = resolve 'foo'
|
||||
assert_equal({
|
||||
"database" => "foo" }, spec)
|
||||
end
|
||||
|
||||
def test_url_host_db
|
||||
spec = resolve 'abstract://foo/bar?encoding=utf8'
|
||||
assert_equal({
|
||||
|
|
Loading…
Reference in New Issue