无法查看 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 %>

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

最新更新