Rails provides three default environments:
# Check current environment
Rails.env.development? # true/false
Rails.env # "development"
# Environment-specific code
if Rails.env.production?
# Production-only code
end
# Custom environments
RAILS_ENV=staging rails server
Each environment has its own configuration file in config/environments/
and database configuration.