小编Ahs*_*san的帖子

使用活动存储 has_one_attached 时堆栈级别太深:图片

我正在尝试为 Ruby on Rails API 项目实现 Active Storage。我已经根据文档放置了 has_one_attached :picture 。并成功在AWS S3服务上上传图片。现在,当我尝试访问志愿者数据时,它说

ActiveStorage::Attachment Load (0.6ms)  SELECT  "active_storage_attachments".* FROM "active_storage_attachments" WHERE
Run Code Online (Sandbox Code Playgroud)

"active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4 [["record_id", 8695], ["record_type"], "Volunteer" ["name", "picture"], ["LIMIT", 1]] ActiveStorage::Blob Load (0.4ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [ ["id", 5], ["LIMIT", 1]] [active_model_serializers] 渲染 ActiveModel::Serializer::Null with ActiveStorage::Attached::One (58.41ms) 在 322ms 内完成 500 个内部服务器错误 (ActiveRecord: 48.8)多发性硬化症)

SystemStackError (stack level too deep):
Run Code Online (Sandbox Code Playgroud)

我已经通过 Rails 控制台检查了数据,图像保存在图片属性中。志愿者的架构如下 …

ruby-on-rails rails-api

3
推荐指数
1
解决办法
1218
查看次数

标签 统计

rails-api ×1

ruby-on-rails ×1