Permalink
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...
1 parent 53aefde commit 12d32ddea2ad6420456ca3f9128023519ef08799 @carlosantoniodasilva carlosantoniodasilva committed Nov 19, 2012
Showing with 4 additions and 8 deletions.
  1. +3 −7 railties/lib/rails/commands/dbconsole.rb
  2. +1 −1 railties/lib/rails/commands/runner.rb
@@ -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
@@ -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."

0 comments on commit 12d32dd

Please sign in to comment.