我的Rails应用程序(在Heroku上运行)有一个登台和生产环境。目前,存在staging.rb和production.rb了很多东西,我不得不在每个文件中单独定义,例如:删除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中,然后覆盖我希望为临时环境更改的设置?
这正是我所期待的。 =)格拉西亚斯! – 2013-02-19 01:40:25
使用ruby 1.9+你可以使用require_relative。 – codingFoo 2014-09-24 18:58:37