在开发/测试模式下,我在config / environments / * .rb:
中添加以下内容config.assets.paths << "whatever_path"
当我开始webrick时,可以通过以下路径访问“whatever_path / collections / image.jpg”中的图像:
http://0.0.0.0:3000/assets/collections/image.jpg
如何(没有fs操作)我可以通过这条路径访问它:
http://0.0.0.0:3000/collections/image.jpg
我需要此重定向才能在测试模式下工作。
答案 0 :(得分:0)
作为我的问题的替代解决方案,我在features / support / asset_host.rb
中添加了以下内容ActionController::Base.asset_host = Proc.new { |source|
true if source["/collections"] and File.exists?(Rails.root.join("whatever_path",source[1..-1]))
}
仅当文件存在于whatever_path
中的虚拟fs中时,才会抑制错误