【发布时间】:2018-12-04 19:12:17
【问题描述】:
我遇到了 ActiveStorage 的问题,目前我的模型上有 has_on_attached 和 has_many_attached 关系
每次我调用我的模型时,它都会加载如下关系:
ActiveStorage::Attachment Load (4.2ms) 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", 4934], ["record_type", "User"], ["name", "profile_picture"], ["LIMIT", 1]]
ActiveStorage::Attachment Exists (0.9ms) SELECT 1 AS one 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", 4934], ["record_type", "User"], ["name", "home_pictures"], ["LIMIT", 1]]
如何默认禁用此行为?
【问题讨论】:
-
你看起来像edgeguides.rubyonrails.org/… 吗?
-
@ClydeT 是的,我还没有看到任何相关内容
标签: ruby-on-rails ruby rails-activestorage