method
env
v5.2.3 -
Show latest stable
- Class:
Rails
env()public
Returns the current Rails environment.
Rails.env # => "development" Rails.env.development? # => true Rails.env.production? # => false
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"