class method
self.resolve_path
Ruby on Rails edge
Since edgeSignature
self.resolve_path(database, root: nil)
Returns a filesystem path to the database.
The configuration’s :database value may be a (slightly nonstandard) SQLite URI, so this method will resolve those URIs to a string path.
If Rails.root is available, this is guaranteed to be an absolute path.
Parameters
-
databasereq -
rootkey = nil
Source
# File activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb, line 82
def resolve_path(database, root: nil)
database = database.to_s
root ||= defined?(Rails.root) ? Rails.root : nil
path = if database.start_with?("file:/")
URI.parse(database).path
elsif database.start_with?("file:")
URI.parse(database.split("?").first).opaque
else
database
end
if root.present?
File.expand_path(path, root)
else
path
end
end
Defined in activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb line 82
· View on GitHub
· Improve this page
· Find usages on GitHub