diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 38ac8bdfeba63d3ddf14b7b32c4b42fe1af791b3..5cb5fa56b35e50578cbc903f36a7a0e52d15aa5e 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,11 @@ +* As promised, switch `sqlite3:///` URLs (which were temporarily + deprecated in 4.1) from relative to absolute. + + If you still want the previous interpretation, you should replace + `sqlite3:///my/path` with `sqlite3:my/path`. + + *Matthew Draper* + * (Temporarily) deprecate SQLite database URLs containing an authority. diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb index 5ede946836ff149230c9a8a5656dfe80174be453..56c533c4016198e905fe4a2a8e17dcb711b85511 100644 --- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb @@ -41,7 +41,6 @@ def initialize(url) else @query = @uri.query end - @authority = url =~ %r{\A[^:]*://} end # Converts the given URL to a full connection hash. @@ -91,21 +90,8 @@ def raw_config end # Returns name of the database. - # Sqlite3's handling of a leading slash is in transition as of - # Rails 4.1. def database_from_path - if @authority && @adapter == 'sqlite3' - # 'sqlite3:///foo' is relative, for backwards compatibility. - - database_name = uri.path.sub(%r{^/}, "") - - msg = "Paths in SQLite3 database URLs of the form `sqlite3:///path` will be treated as absolute in Rails 4.2. " \ - "Please switch to `sqlite3:#{database_name}`." - ActiveSupport::Deprecation.warn(msg) - - database_name - - elsif @adapter == 'sqlite3' + if @adapter == 'sqlite3' # 'sqlite3:/foo' is absolute, because that makes sense. The # corresponding relative version, 'sqlite3:foo', is handled # elsewhere, as an "opaque". diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb index a4fe87049aae5f8d0ae47f776c95e6261017d699..3c2f5d4219d85186c72f08479fcdc4a2c195a2c8 100644 --- a/activerecord/test/cases/connection_specification/resolver_test.rb +++ b/activerecord/test/cases/connection_specification/resolver_test.rb @@ -83,8 +83,8 @@ def test_encoded_password end def test_url_with_authority_for_sqlite3 - spec = assert_deprecated { resolve 'sqlite3:///foo_test' } - assert_equal('foo_test', spec["database"]) + spec = resolve 'sqlite3:///foo_test' + assert_equal('/foo_test', spec["database"]) end def test_url_absolute_path_for_sqlite3