如何在不同主机名下本地托管资产?

时间:2013-01-07 23:49:07

标签: ruby-on-rails ruby localhost asset-pipeline assets

我想从多个主机名ex http://assets1.somehost.dev, http://assets2.somehost.dev

测试我的资产

我的资产来自development.rb

config.serve_static_assets = false
config.assets.compile = true
config.assets.digest = true
config.action_controller.asset_host = "http://assets%d.somehost.com"
config.assets.compress = false
config.assets.debug = false

所以我想设置config.action_controller.asset_host = "http://assets%d.somehost.dev"

在本地进行测试。

1 个答案:

答案 0 :(得分:1)

将以下行添加到您的hosts文件中(我认为 rails默认情况下仅使用四个资源主机):

127.0.0.1 http://assets1.somehost.dev http://assets2.somehost.dev http://assets3.somehost.dev http://assets4.somehost.dev

Wikipedia根据您的平台列出了where to find your hosts file