From b3125c89f42968bec6ee0b92ab93e36dbc36d5c3 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Wed, 24 Oct 2012 15:04:12 -0700 Subject: Make sure that RAILS_ENV is set when accessing Rails.env Fixes #8025 --- railties/lib/rails.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index dd51a6fb01..6bf2d8db20 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -85,7 +85,10 @@ module Rails end def env - @_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development") + @_env ||= begin + ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" + ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"]) + end end def env=(environment) -- cgit v1.2.3