mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Refactor config abort message a bit for dbconsole
Remove not used variable. Remove config attr_reader causing warning. Fix indent in runner file.
This commit is contained in:
parent
53aefdec91
commit
12d32ddea2
2 changed files with 4 additions and 8 deletions
|
@ -5,7 +5,7 @@ require 'rbconfig'
|
|||
|
||||
module Rails
|
||||
class DBConsole
|
||||
attr_reader :config, :arguments
|
||||
attr_reader :arguments
|
||||
|
||||
def self.start
|
||||
new.start
|
||||
|
@ -82,17 +82,13 @@ module Rails
|
|||
def config
|
||||
@config ||= begin
|
||||
cfg = begin
|
||||
cfg = YAML.load(ERB.new(IO.read("config/database.yml")).result)
|
||||
YAML.load(ERB.new(IO.read("config/database.yml")).result)
|
||||
rescue SyntaxError, StandardError
|
||||
require APP_PATH
|
||||
Rails.application.config.database_configuration
|
||||
end
|
||||
|
||||
unless cfg[environment]
|
||||
abort "No database is configured for the environment '#{environment}'"
|
||||
end
|
||||
|
||||
cfg[environment]
|
||||
cfg[environment] || abort("No database is configured for the environment '#{environment}'")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ ENV["RAILS_ENV"] = options[:environment]
|
|||
|
||||
require APP_PATH
|
||||
Rails.application.require_environment!
|
||||
Rails.application.load_runner
|
||||
Rails.application.load_runner
|
||||
|
||||
if code_or_file.nil?
|
||||
$stderr.puts "Run '#{$0} -h' for help."
|
||||
|
|
Loading…
Reference in a new issue