【发布时间】:2022-08-09 23:22:47
【问题描述】:
我很难找出解决问题的方法。
我有一个在 Docker 中运行的 ror 应用程序。在开发中,上传的 pdf 存储在 ./storage 目录中,并且它们在我的应用程序中按预期呈现。在生产中,上传到同一目录中,但它们不会显示。
我检查了目录和文件的权限,它们似乎没问题。
我的配置:
storage.yml :
local:
service: Disk
root: <%= Rails.root.join(\"storage\") %>
production.rb :
config.active_storage.service = :local
_attachment.html.erb :
<% if territory.file.previewable? %>
<div class=\"container\">
<embed type=\"application/pdf\" src=\"<%= rails_blob_path(@territory.file, disposition: :inline) %>\" width=\"100%\" height=\"500px\">
</div>
<% end %>
这部分在我的视图中呈现如下:
<p>
<%= render \"territories/attachment\", territory: territory %>
</p>
我错过了什么吗? 感谢您的帮助,并保持保存在那里!
标签: ruby-on-rails ruby docker