class

ActiveStorage::Attached::Many

Inherits Enumerable < Reference < Object

The has_many_attached proxy. Collection methods (map/each/size/…) go straight to the attachment rows — the port's equivalent of the gem's delegate_missing_to :attachments for the collection case.

Constructors

new(name : String, record : ActiveRecord::Base)
Source

Instance methods

attach(io : String, filename : String, content_type : String) : Nil

Attaches one attachable or several at once. An attachable is an io/filename/content_type triple, an existing Blob, or a blob's signed_id (the direct-upload form: the blob was created and uploaded before the form was submitted).

Source
attach(attachables : Array(Blob | String)) : Nil
Source
attach(blob : Blob) : Nil
Source
attach(signed_id : String) : Nil
Source
attach(io_triplets : Array(Tuple(String, String, String))) : Nil
Source
attached?
Source
attachments
Source
blobs
Source
detach

Drops the attachment rows; blobs (and their service files) stay.

Source
download
Source
each

Must yield this collection's elements to the block.

Source
purge

Destroys the blobs (with their attachment rows and service files).

Source