【发布时间】:2012-04-01 06:15:39
【问题描述】:
我正在尝试升级到雪松/资产管道,但遇到了一些问题。
一切都很好,但我的应用程序似乎明显变慢了。翻阅我的日志,我看到了大量这样的项目:
2012-03-15T17:03:02+00:00 应用程序[web.1]:缓存:[GET /assets/application.js] 错过 2012-03-15T17:03:02+00:00 app[web.1]: 缓存:[GET /assets/down_arrow.gif] 错过 2012-03-15T17:03:02+00:00 app[web.1]:缓存:[GET /assets/application.css] 未命中
我希望这些会很受欢迎——对吧?
我的生产.rb
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
# For nginx:
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# I also tried these
# config.action_dispatch.x_sendfile_header = "X-Sendfile"
# config.action_dispatch.x_sendfile_header = nil
config.cache_store = :dalli_store
我的应用程序.rb
...
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.assets.initialize_on_precompile = false
config.active_support.deprecation = :log
注意:assets:precompile 在部署时工作正常:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
谢谢!如果您需要更多信息,请告诉我
【问题讨论】:
-
部署时是否在 Heroku 日志中看到资产编译?
-
应该有类似
-----> Preparing app for Rails asset pipeline Running: rake assets:precompile -
是的——我会用该信息更新问题
标签: ruby-on-rails caching heroku asset-pipeline