From 97eb21c390585de13bd3d2b4cf1d261a300423c8 Mon Sep 17 00:00:00 2001 From: Jason King Date: Mon, 2 Mar 2009 12:34:41 +1100 Subject: [PATCH] Fixed command line parsing of environment --- railties/bin/console | 9 +++++++++ railties/lib/commands/console.rb | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/railties/bin/console b/railties/bin/console index 498077a..0227ebe 100755 --- a/railties/bin/console +++ b/railties/bin/console @@ -1,3 +1,12 @@ #!/usr/bin/env ruby + +ENV['RAILS_ENV'] = case ARGV.first + when "p"; "production" + when "d"; "development" + when "t"; "test" + else + ARGV.first || ENV['RAILS_ENV'] || 'development' +end + require File.dirname(__FILE__) + '/../config/boot' require 'commands/console' diff --git a/railties/lib/commands/console.rb b/railties/lib/commands/console.rb index 45acd18..a252a19 100644 --- a/railties/lib/commands/console.rb +++ b/railties/lib/commands/console.rb @@ -25,14 +25,6 @@ if options[:debugger] end end -ENV['RAILS_ENV'] = case ARGV.first - when "p"; "production" - when "d"; "development" - when "t"; "test" - else - ARGV.first || ENV['RAILS_ENV'] || 'development' -end - if options[:sandbox] puts "Loading #{ENV['RAILS_ENV']} environment in sandbox (Rails #{Rails.version})" puts "Any modifications you make will be rolled back on exit" -- 1.6.1