我正在尝试使用ActiveStorage将 Rails 应用程序升级到 RoR6 。\n在视图中,我image_tag在所附图像上使用了名为“whiteboard_background”的图像@project。
它在浏览器中显示损坏的链接:\n链接
\n\n环境:开发和本地存储的文件
\n\n模型:
\n\nclass Project < ApplicationRecord\n\n has_one_attached :whiteboard_background\nRun Code Online (Sandbox Code Playgroud)\n\n查看代码:
\n\nattachment: <%= @project.whiteboard_background.attached? %>\n<p>image:\n<%= image_tag @project.whiteboard_background if @project.whiteboard_background.attached? %>\n</p>\nRun Code Online (Sandbox Code Playgroud)\n\n服务器:
\n\nStarted GET "/projects/6" for 127.0.0.1 at 2020-02-19 20:29:27 +0100\nProcessing by ProjectsController#show as HTML\n Parameters: {"id"=>"6"}\n...\nActiveStorage::Attachment Load (2.8ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4 [["record_id", 6], ["record_type", "Project"], ["name", "whiteboard_background"], …Run Code Online (Sandbox Code Playgroud)