v7.1.3.2 - Show latest stable - 0 notes - Class: Blob
open(tmpdir: nil, &block) public

Downloads the blob to a tempfile on disk. Yields the tempfile.

The tempfile’s name is prefixed with ActiveStorage- and the blob’s ID. Its extension matches that of the blob.

By default, the tempfile is created in Dir.tmpdir. Pass tmpdir: to create it in a different directory: "/path/to/tmp") do |file|
  # ...

The tempfile is automatically closed and unlinked after the given block is executed.

Raises ActiveStorage::IntegrityError if the downloaded data does not match the blob’s checksum.

Show source
Register or log in to add new notes.