aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/lib/rails.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb
index e7172e491f..a1a105ef2b 100644
--- a/railties/lib/rails.rb
+++ b/railties/lib/rails.rb
@@ -56,10 +56,18 @@ module Rails
application && application.config.root
end
+ # Returns the current Rails environment.
+ #
+ # Rails.env # => "development"
+ # Rails.env.development? # => true
+ # Rails.env.production? # => false
def env
@_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development")
end
+ # Sets the Rails environment.
+ #
+ # Rails.env = "staging" # => "staging"
def env=(environment)
@_env = ActiveSupport::StringInquirer.new(environment)
end