diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2010-01-11 14:01:28 -0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2010-01-11 14:01:28 -0800 |
commit | 8cb594a2e1808cd7d93f3593afed0414016fc56f (patch) | |
tree | 766eeb882eb4cfd9a6a13893a7b0ca7f35811650 /railties/lib/rails/commands/console.rb | |
parent | a9eebde8561df5c7c34669587c9e25e8baeeeabb (diff) | |
download | rails-8cb594a2e1808cd7d93f3593afed0414016fc56f.tar.gz rails-8cb594a2e1808cd7d93f3593afed0414016fc56f.tar.bz2 rails-8cb594a2e1808cd7d93f3593afed0414016fc56f.zip |
Get everyone running on Rails.env and fix the broken environment settings for script/console and script/dbconsole
Diffstat (limited to 'railties/lib/rails/commands/console.rb')
-rw-r--r-- | railties/lib/rails/commands/console.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index d154808029..27ac7fd20a 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -4,8 +4,6 @@ require "irb/completion" module Rails class Console - ENVIRONMENTS = %w(production development test) - def self.start(app) new(app).start end @@ -25,10 +23,6 @@ module Rails opt.parse!(ARGV) end - if env = ARGV.pop - ENV['RAILS_ENV'] = ENVIRONMENTS.find { |e| e.index(env) } || env - end - @app.initialize! require "rails/console_app" require "rails/console_sandbox" if options[:sandbox] @@ -54,3 +48,8 @@ module Rails end end end + +# Has to set the RAILS_ENV before config/application is required +if ARGV.first && !ARGV.first.index("-") && env = ARGV.pop # has to pop the env ARGV so IRB doesn't freak + ENV['RAILS_ENV'] = %w(production development test).find { |e| e.index(env) } || env +end |