aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/commands/runner.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/commands/runner.rb')
-rw-r--r--railties/lib/commands/runner.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/railties/lib/commands/runner.rb b/railties/lib/commands/runner.rb
index 7d1b56e3f9..c7a70a1b0b 100644
--- a/railties/lib/commands/runner.rb
+++ b/railties/lib/commands/runner.rb
@@ -20,7 +20,11 @@ ARGV.options do |opts|
opts.parse!
end
-ENV["RAILS_ENV"] = options[:environment]
+if defined?(RAILS_ENV)
+ RAILS_ENV.replace(options[:environment])
+else
+ ENV["RAILS_ENV"] = options[:environment]
+end
require RAILS_ROOT + '/config/environment'
-eval(ARGV.first) \ No newline at end of file
+eval(ARGV.first)