class Blob

Ruby on Rails 6.0.6

Since v5.2.8.1

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

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:

  1. Ahead of the file being uploaded server-side to the service, via create_and_upload!. A rewindable io with the file contents must be available at the server for this operation.

  2. 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

ActiveRecord::Base

Namespace

Modules

Includes

Methods (defined here)

Private methods

(7) Implementation detail — not part of the public API.

Methods (inherited)

From ActiveStorage::Blob::Analyzable (3)
From ActiveStorage::Blob::Identifiable (2)
From ActiveStorage::Blob::Representable (6)
From ActiveModel::Conversion (4)
From ActiveModel::Naming (7)
From ActiveRecord::Aggregations::ClassMethods (1)
From ActiveRecord::AttributeMethods (9)
From ActiveRecord::AutosaveAssociation (6)
From ActiveRecord::ConnectionHandling (13)
From ActiveRecord::Core (31)
From ActiveRecord::Enum (1)
From ActiveRecord::Inheritance (1)
From ActiveRecord::Integration (7)
From ActiveRecord::Locking::Pessimistic (2)
From ActiveRecord::ModelSchema (14)
From ActiveRecord::NoTouching (1)
From ActiveRecord::Persistence (25)
From ActiveRecord::QueryCache::ClassMethods (2)
From ActiveRecord::Querying (2)
From ActiveRecord::Validations (4)
From ActiveSupport::Benchmarkable (1)
From ActiveSupport::Concern (2)
From ActiveSupport::DescendantsTracker (7)
From Object (17)
From ActiveModel::AttributeAssignment (2)
From ActiveModel::AttributeMethods (4)
From ActiveModel::Translation (3)
From ActiveModel::Validations (6)
From ActiveRecord::AttributeMethods::BeforeTypeCast (2)
From ActiveRecord::AttributeMethods::Dirty (13)
From ActiveRecord::AttributeMethods::PrimaryKey (7)
From ActiveRecord::AttributeMethods::Query (1)
From ActiveRecord::AttributeMethods::Read (2)
From ActiveRecord::AttributeMethods::Write (1)
From ActiveRecord::TestFixtures (4)
From ActiveSupport::Autoload (6)
From ActiveModel::Callbacks (1)
From ActiveModel::Dirty (9)
From ActiveModel::Validations::HelperMethods (10)
From ActiveSupport::Callbacks (1)

Type at least 2 characters to search.

↑↓ navigate · open · esc close