method
env
v2.3.8 -
Show latest stable
- Class:
Rails
env()public
No documentation available.
# File railties/lib/initializer.rb, line 55
def env
@_env ||= ActiveSupport::StringInquirer.new(RAILS_ENV)
end 2Notes
Pretty way to test for current environment
You can check your current Rails environment using nice methods such as:
Rails.env.development?
Rails.env.test?
Rails.env.production?
Rails.env.your_custom_environment?
Used to get current Rails environment
Rails#env returns a string representing the current Rails environment.
==== Code example
>> Rails.env # in development mode
Rails.env
=> "development"