Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 用于查询带有附件记录id的Blob的活动记录DSL是什么?_Sql_Ruby On Rails_Activerecord_Rails Activestorage - Fatal编程技术网

Sql 用于查询带有附件记录id的Blob的活动记录DSL是什么?

Sql 用于查询带有附件记录id的Blob的活动记录DSL是什么?,sql,ruby-on-rails,activerecord,rails-activestorage,Sql,Ruby On Rails,Activerecord,Rails Activestorage,对于以下查询,什么是正确的、性能最好的活动记录DSL SELECT filename, content_type FROM active_storage_blobs blobs INNER JOIN active_storage_attachments attachments ON attachments.record_id = 3 WHERE blobs.id = attachments.blob_id 我正在尝试选择活动\u存储\u blob中特定记录的文件名和内容类型 这是带有文件附

对于以下查询,什么是正确的、性能最好的活动记录DSL

SELECT filename, content_type
FROM active_storage_blobs blobs
INNER JOIN active_storage_attachments attachments 
ON attachments.record_id = 3
WHERE blobs.id = attachments.blob_id 
我正在尝试选择活动\u存储\u blob中特定记录的文件名和内容类型

这是带有文件附件的我的图像模型:

class Image < ApplicationRecord
  has_one_attached :file
end
类映像