diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-12-01 00:08:33 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-12-01 00:08:33 +0000 |
commit | 9040f406820a9cd2d6a016fd2a7965d21445bbec (patch) | |
tree | bf2110842dc41d39e76c6dddf671a8e6d5ac9fd2 /railties/lib | |
parent | cd2be89b7c6ba341d4a45cd1767509d4a3aedb70 (diff) | |
download | rails-9040f406820a9cd2d6a016fd2a7965d21445bbec.tar.gz rails-9040f406820a9cd2d6a016fd2a7965d21445bbec.tar.bz2 rails-9040f406820a9cd2d6a016fd2a7965d21445bbec.zip |
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
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/commands/console.rb | 9 |
1 files changed, 8 insertions, 1 deletions
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." |