= private = protected
env()
Returns the current Rails environment.
Rails.env # => "development" Rails.env.development? # => true Rails.env.production? # => false
# File railties/lib/rails.rb, line 72 def env @_env ||= ActiveSupport::EnvironmentInquirer.new(ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development") end
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?
Rails#env returns a string representing the current Rails environment.
>> Rails.env # in development mode Rails.env => "development"