我刚刚将Heroku中的应用从Rails 3.0升级到3.1,并试图使资产管道工作。主要的问题是,我可以阅读从Heroku的日志中的以下样线,对每一项资产:在Heroku上更新到Rails 3.1时的资产管道
2011-09-03T16:35:28+00:00 app[web.1]: cache: [GET /assets/border-a3c571a354b9381740db48aeebfaa63a.jpg] miss
如果我理解正确的管道,这不应该是“小姐”为每个请求,我从一个做浏览器,但它应该在缓存中找到。
阅读Heroku的文档,你可以找到这样的解释:
Rails 3.1 provides an assets:precompile rake task to allow the compilation penalty to be paid up front rather than each time the asset is requested. If this task exists in your app we will execute it when you push new code.
但是应该怎样说,“资产:预编译”的任务是什么?我试图用rails 3.1从头开始构建一个项目来试图找出问题,但在裸露的项目中没有这样的任务。或者我错过了什么?我怎么能让这些资产在缓存中找到?也许只是配置问题。
这些都是我的生产配置文件的选项:
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = true # If I turn this off I get a 500 error and logs say that an asset isn't compiled
我的application.rb中有这样一行:
config.assets.enabled = true
非常感谢您的帮助!
我直接编译在Heroku上的资产,不会产生污染我的本地库与compliled资产。 使用命令:heroku运行rake资产:预编译 –