From 9040f406820a9cd2d6a016fd2a7965d21445bbec Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 1 Dec 2006 00:08:33 +0000 Subject: Added one-letter aliases for the three default environments to script/console, so script/console p will load the production environment (t for test, d for development) [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5655 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/commands/console.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'railties/lib/commands') diff --git a/railties/lib/commands/console.rb b/railties/lib/commands/console.rb index 8b35a8d296..5abdb49273 100644 --- a/railties/lib/commands/console.rb +++ b/railties/lib/commands/console.rb @@ -15,7 +15,14 @@ libs << " -r console_app" libs << " -r console_sandbox" if options[:sandbox] libs << " -r console_with_helpers" -ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development' +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." puts "Any modifications you make will be rolled back on exit." -- cgit v1.2.3