aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2012-10-24 15:04:12 -0700
committerSteve Klabnik <steve@steveklabnik.com>2012-10-31 17:05:26 -0700
commitb3125c89f42968bec6ee0b92ab93e36dbc36d5c3 (patch)
treecae75db71b555c52e6f37595f229c75100df6181 /railties/lib
parentd3494903719682abc0948bef290af0d3d7b5a440 (diff)
downloadrails-b3125c89f42968bec6ee0b92ab93e36dbc36d5c3.tar.gz
rails-b3125c89f42968bec6ee0b92ab93e36dbc36d5c3.tar.bz2
rails-b3125c89f42968bec6ee0b92ab93e36dbc36d5c3.zip
Make sure that RAILS_ENV is set when accessing Rails.env
Fixes #8025
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails.rb5
1 files changed, 4 insertions, 1 deletions
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)