aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/dbconsole.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/commands/dbconsole.rb')
-rw-r--r--railties/lib/rails/commands/dbconsole.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb
index 90359d1c08..d614328e52 100644
--- a/railties/lib/rails/commands/dbconsole.rb
+++ b/railties/lib/rails/commands/dbconsole.rb
@@ -6,7 +6,7 @@ require 'rbconfig'
module Rails
class DBConsole
attr_reader :config, :arguments
-
+
def self.start
new.start
end
@@ -59,7 +59,7 @@ module Rails
args << "-#{options['mode']}" if options['mode']
args << "-header" if options['header']
- args << File.expand_path(config['database'], Rails.root)
+ args << File.expand_path(config['database'], Rails.respond_to?(:root) ? Rails.root : nil)
find_cmd_and_exec('sqlite3', *args)
@@ -108,7 +108,7 @@ module Rails
def parse_arguments(arguments)
options = {}
-
+
OptionParser.new do |opt|
opt.banner = "Usage: rails dbconsole [environment] [options]"
opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v|
@@ -123,7 +123,7 @@ module Rails
opt.on("--header") do |h|
options['header'] = h
end
-
+
opt.on("-h", "--help", "Show this help message.") do
puts opt
exit
@@ -142,7 +142,7 @@ module Rails
env = arguments.first
options[:environment] = %w(production development test).detect {|e| e =~ /^#{env}/} || env
end
-
+
options
end