每次我使用Capistrano进行部署时,都会从页面中删除两个图像

问题描述:

我有一个Spree Webshop Ruby on Rails应用程序。每次我运行 cap deploy 并查看页面时,主页上显示的三个产品图像中的两个都消失了。

I have a Spree Webshop Ruby on Rails application. Every time I run cap deploy and I look at my page, two of the three product images that are displayed on the mainpage are gone.

这两个图像仍作为替代文本显示在管理页面上(而不是实际图像)。当我单击它时,会收到以下消息:

The two images still display at the admin page as an alternative text (so not the actual image). When I click it I get the following message:

No route matches [GET] "/spree/products/7/product/imagename.png"

Rails.root: /rails/releases/20140127203640

我处理图像的方式没有区别,我昨天都将它们添加到页面中。我不知道这是怎么回事,所以我不知道要发布什么额外的信息。有人知道怎么可能吗?

There is no difference between how I handled the images, I all added them yesterday to the page. I have no idea how this can be so I don't know what extra information to post. Anyone any idea how this is possible?

/ EDIT因此,一个想法是将服务器上的public / spree目录与Capistrano目录(?)符号链接。我该怎么做

/EDIT So one idea was to symlink the public/spree directory on the server with the Capistrano directory (?). How do I do this

namespace :deploy do
  task :symlink_shared do
     run "ln -nfs #{shared_path}/public/spree/ #{release_path}/public/spree/"
  end

您需要确保您的 RAILS_ROOT / public / spree 目录正在从Capistrano共享目录中进行符号链接,并且不会在每次部署时重新创建。如果此符号链接没有发生,则每次部署都会丢失您的映像。

You need to make sure that your RAILS_ROOT/public/spree directory is being symlinked in from the Capistrano shared directory and not recreated every time you deploy. If this symlink isn't happening, your images will be lost on every deploy.