instance method
uploaded
Ruby on Rails edge
Since edgeSignature
uploaded(io:)
Called by Attached::Changes::CreateOne to handle the upload workflow for fresh uploads. Processes immediate variants and analyzes from the local io (avoiding a download round-trip), uploads the blob, then runs the :upload callbacks.
For existing blob attachments, the :upload callbacks are run via after_create_commit instead.
Parameters
-
iokeyreq
Source
# File activestorage/app/models/active_storage/attachment.rb, line 71
def uploaded(io:)
blob.local_io = io
process_immediate_variants_from_io(io)
analyze_blob_from_io(io)
io.rewind if io.respond_to?(:rewind)
blob.upload_without_unfurling(io)
# Persist analysis metadata if the blob was already saved (happens when
# upload runs in after_commit, after the blob was saved via autosave).
blob.save! if blob.persisted? && blob.metadata_changed?
run_upload_callbacks
ensure
blob.local_io = nil
end
Defined in activestorage/app/models/active_storage/attachment.rb line 71
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Attachment