这是在生产应用程序中。我怀疑在文件上传(直接上传到 S3)期间发生了一些事情,并且 blob 没有正确创建。
现在应用程序在某些情况下会崩溃,我正在尝试删除“幽灵”附件而不删除父记录。这可能吗?
irb(main):020:0> s2.presentation_file.attached?
=> true
irb(main):021:0> s2.presentation_file.attachment
=> #<ActiveStorage::Attachment id: 362, name: "presentation_file", record_type: "Speaker", record_id: 219, blob_id: 369, created_at: "2018-05-06 19:44:06">
irb(main):022:0> s2.presentation_file.attachment.blob
=> nil
irb(main):023:0> s2.presentation_file.purge
NoMethodError: undefined method `purge' for nil:NilClass
from (irb):23