ActiveStorage - has_one_attached ... analyze: false

I’m dealing with a bunch of large-ish video files. I upload them directly to S3 and then attach to my VideoEdit record.

I don’t need the info that the AnalyseJob would provide, and downloading large files from S3 is unnecessary work/cost.

What’s the best way to disable analysis for a single attachment?

Claude and ChatGPT are convinced that I can do

has_one_attached :video, analyze: false

This seems to be a hallucination - but I wonder if it indicates an approach that people are taking in real life?

My current approach is

  def video=(attachable)
    # Call the original method to set the attachment
    super

    # Mark as analyzed to prevent analysis jobs
    if video.attached? && video.blob.present? && !video.blob.analyzed?
      video.blob.update!(analyzed: true)
    end
  end

which isn’t terrible, but it is getting into the implementation details.

any suggestions?

fwiw I asked my chatgpt for a second opinion :slight_smile: