Ruby on rails 如何使资产管道处理子目录中的图像

Ruby on rails 如何使资产管道处理子目录中的图像,ruby-on-rails,asset-pipeline,Ruby On Rails,Asset Pipeline,我有一个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 当我在生产模式下本地运行

我有一个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

config.assets.compile=true是问题所在。这不是你认为它应该做的。这实际上告诉服务器按需编译。这也许可以解释为什么你有时会看到这些文件,有时却看不到


如果要添加目录,请将它们添加到config.assets.path。

预编译列表中的“所有非JS/CSS都已添加”,因此您甚至不需要指定要包含的图像扩展名。。。另外,我认为您不需要将config.assets.compile设置为true,因为您正在进行预编译。