Skip to content

Commit 66a9322

Browse files
authored
Merge pull request rails#54498 from skipkayhil/hm-fix-sqlite-dbconsole-root
Fix sqlite3 dbconsole not working outside Rails
2 parents 57c2494 + 52f55dd commit 66a9322

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Fix using the `SQLite3Adapter`'s `dbconsole` method outside of a Rails application.
2+
3+
*Hartley McGuire*
4+
15
* Fix migrating multiple databases with `ActiveRecord::PendingMigration` action.
26

37
*Gannon McGibbon*

activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def dbconsole(config, options = {})
6262

6363
args << "-#{options[:mode]}" if options[:mode]
6464
args << "-header" if options[:header]
65-
args << File.expand_path(config.database, Rails.respond_to?(:root) ? Rails.root : nil)
65+
args << File.expand_path(config.database, defined?(Rails.root) ? Rails.root : nil)
6666

6767
find_cmd_and_exec(ActiveRecord.database_cli[:sqlite], *args)
6868
end

0 commit comments

Comments
 (0)