我生產asset_host的配置是這樣的:軌3.1無法在督促編制資產因資產宿主配置
config.action_controller.asset_host = Proc.new { |source, request|
if request.ssl?
"#{request.protocol}#{request.host_with_port}"
else
"#{request.protocol}assets#{(source.length % 4) + 1}.example.com"
end
}
...這是或多或少直接從文檔:
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
當我去資產:預編譯,我得到這個:
$ RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
This asset host cannot be computed without a request in scope. Remove
the second argument to your asset_host Proc if you do not need the
request.
.... EXCE因爲我需要 知道請求是否是ssl,所以我無法真正刪除第二個arg。也就是說,我知道 請求在rake任務期間不存在以產生資產....
那麼,我該如何擺脫這個問題呢?
如你所知,修復被恢復! –