… а я нашел ответ:
Item.reflections.keys
=> ["location", "images_attachments", "images_blobs", "taggings", "base_tags", "tag_taggings", "tags"]
Имя сгенерированной Active Storage ассоциации - images_attachments
, хотя оно доступно через Item#images
. Вот решение:
Item.includes(:images_attachments)
Item Load (0.6ms) SELECT "items".* FROM "items" LIMIT $1 [["LIMIT", 11]]
ActiveStorage::Attachment Load (0.6ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_type" = $1 AND "active_storage_attachments"."name" = $2 AND "active_storage_attachments"."record_id" IN ($3, $4, $5, $6, $7) [["record_type", "Item"], ["name", "images"], ["record_id", 3], ["record_id", 2], ["record_id", 4], ["record_id", 5], ["record_id", 1]]
=> #<ActiveRecord::Relation […]>