在 Rails 5.1.4 上看不到 Paperclip 上传的文件

Can't see files uploaded by Paperclip on Rails 5.1.4

我是 运行 Rails 5.1.4 和 Paperclip 5.1

当我查看我的索引文件时,出现以下错误并且没有显示图像。它们确实存在于 /public/system/.../images/000/000/... 位置。任何帮助将不胜感激。

ActionController::RoutingError (No route matches [GET] "/system/recipes/images/000/000/008/medium/Capture777.PNG"):

ActionController::RoutingError (No route matches [GET] "/system/recipes/images/000/000/011/medium/alaska_STandard_time.png"):

当图像已保存在系统文件夹中,但您无法在视图中渲染它时,可能是因为它们在模型中定义的选项配置错误。

如果您使用某种风格来展示您的图片,例如

  • model.attachment.url :style

尝试在不使用样式的情况下访问图像,这样您就可以使用 image_tag 助手来渲染它:

<% image_tag model.attachment.url %>

如果有效,则问题出在回形针配置中。在各自的模型中。