我有一个 Rails 应用程序,它最初是 3.0.x 应用程序,最近升级到 3.2.2。图片位于 app/assets/images/ecommerce/new 中,当我在rake assets:precompile
本地运行时,它们不会复制到 public/assets/。但是,当我将所有图像文件从 app/assets/images/ecommerce/new 复制到根图像资产路径(即 app/assets/imagens)并再次运行 rake 任务时,图像全部发送到 public/assets .
当我在生产模式下本地运行服务器时,它找不到图像,但是当我部署到 Engine Yard 时,它找到了。这很奇怪,你知道发生了什么吗?
资产管道不能处理 app/assets/images 子目录内的图像吗?我错过了什么吗?
以下是 config/environments/production.rb 的来源,关于资产管道的内容:
MyApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.cache_classes = 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 = true
config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif]
# Generate digests for assets URLs
config.assets.digest = true