diff options
author | claudiob <claudiob@gmail.com> | 2014-12-20 10:09:45 -0800 |
---|---|---|
committer | claudiob <claudiob@gmail.com> | 2014-12-22 03:44:37 +0100 |
commit | a770d7e404f994d717843035eba9c1094a6e90d8 (patch) | |
tree | 4d96a53c18ea98b1687e5027aab6e6d6df1bee92 /railties | |
parent | 0222cefc405c4de7e4667a20c8e3cc4fd3200497 (diff) | |
download | rails-a770d7e404f994d717843035eba9c1094a6e90d8.tar.gz rails-a770d7e404f994d717843035eba9c1094a6e90d8.tar.bz2 rails-a770d7e404f994d717843035eba9c1094a6e90d8.zip |
Add docs for `Rails.env` and `Rails.env=`
[ci skip]
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails.rb | 8 |
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 |