我的 Rails 应用程序(在 Heroku 上运行)有一个登台和生产环境。目前,staging.rb 和 production.rb 中有很多东西我必须在每个文件中单独定义,例如:
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
这不是DRY
。有没有一种优雅的方法可以有效地将 production.rb 中的设置导入到 staging.rb 中,然后只覆盖我希望为暂存环境更改的设置?