Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor config abort message a bit for dbconsole

Remove not used variable.
Remove config attr_reader causing warning.
Fix indent in runner file.
  • Loading branch information...
commit 12d32ddea2ad6420456ca3f9128023519ef08799 1 parent 53aefde
Carlos Antonio da Silva carlosantoniodasilva authored
10 railties/lib/rails/commands/dbconsole.rb
View
@@ -5,7 +5,7 @@
module Rails
class DBConsole
- attr_reader :config, :arguments
+ attr_reader :arguments
def self.start
new.start
@@ -82,17 +82,13 @@ def start
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
2  railties/lib/rails/commands/runner.rb
View
@@ -41,7 +41,7 @@
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."
Please sign in to comment.
Something went wrong with that request. Please try again.