diff options
Diffstat (limited to 'railties/lib/rails/commands.rb')
-rw-r--r-- | railties/lib/rails/commands.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index 7f473c237c..8816387d34 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -36,9 +36,17 @@ when 'benchmarker', 'profiler' when 'console' require 'rails/commands/console' + options = Rails::Console.parse_arguments(ARGV) + + # RAILS_ENV needs to be set before config/application is required + ENV['RAILS_ENV'] = options[:environment] if options[:environment] + + # shift ARGV so IRB doesn't freak + ARGV.shift if ARGV.first && ARGV.first[0] != '-' + require APP_PATH Rails.application.require_environment! - Rails::Console.start(Rails.application) + Rails::Console.start(Rails.application, options) when 'server' # Change to the application's path if there is no config.ru file in current dir. |