Heroku advices against使用默认的Rails'创建自定义环境的方法:config/environments/staging.rb
相反,他们建议使用their config vars。
我是否正确理解,以确定在哪个"环境"代码在我将设置如下变量:
heroku config:set CUSTOM_ENV=staging --remote my_staging_app
heroku config:set CUSTOM_ENV=production --remote my_production_app
然后在我的代码中:
send_real_mail if ENV['CUSTOM_ENV'] == "production"