class Blob
Ruby on Rails 8.0.4
Since v5.2.8.1Active Storage Blob
A blob is a record that contains the metadata about a file and a key for where that file resides on the service. Blobs can be created in two ways:
-
Ahead of the file being uploaded server-side to the service, via
create_and_upload!. A rewindableiowith the file contents must be available at the server for this operation. -
Ahead of the file being directly uploaded client-side to the service, via
create_before_direct_upload!.
The first option doesn’t require any client-side JavaScript integration, and can be used by any other back-end service that deals with files. The second option is faster, since you’re not using your own server as a staging point for uploads, and can work with deployments like Heroku that do not provide large amounts of disk space.
Blobs are intended to be immutable in as-so-far as their reference to a specific file goes. You’re allowed to update a blob’s metadata on a subsequent pass, but you should not update the key or change the uploaded file. If you need to create a derivative or otherwise change the blob, simply create a new blob and purge the old one.
Inherits from
Namespace
Modules
Includes
Constants
Methods (defined here)
- # attachments
- # audio?
- # custom_metadata
- # custom_metadata=
- # delete
- # download
- # download_chunk
- # filename
- # image?
- # key
- # open
- # purge
- # purge_later
- # service
- # service_headers_for_direct_upload
- # service_url_for_direct_upload
- # signed_id
- # text?
- # upload
- # url
- # video?
- self. compose
- self. create_and_upload!
- self. create_before_direct_upload!
- self. find_signed
- self. find_signed!
- self. generate_unique_secure_token
- self. unattached
Private methods
(6)
Implementation detail — not part of the public API.
Methods (inherited)
From ActiveStorage::Blob::Analyzable (3)
- # analyze
- # analyze_later
- # analyzed?
From ActiveStorage::Blob::Representable (6)
- # preview
- # previewable?
- # representable?
- # representation
- # variable?
- # variant
From ActiveSupport::Concern (3)
- # class_methods
- # included
- # prepended