class method
self.create_before_direct_upload!
Ruby on Rails 8.1.2
Since v5.2.8.1Signature
self.create_before_direct_upload!(key: nil, filename:, byte_size:, checksum:, content_type: nil, metadata: nil, service_name: nil, record: nil)
Returns a saved blob without uploading a file to the service. This blob will point to a key where there is no file yet. It’s intended to be used together with a client-side upload, which will first create the blob in order to produce the signed URL for uploading. This signed URL points to the key generated by the blob. Once the form using the direct upload is submitted, the blob can be associated with the right record using the signed ID.
Parameters
-
keykey = nil -
filenamekeyreq -
byte_sizekeyreq -
checksumkeyreq -
content_typekey = nil -
metadatakey = nil -
service_namekey = nil -
recordkey = nil
Source
# File activestorage/app/models/active_storage/blob.rb, line 106
def create_before_direct_upload!(key: nil, filename:, byte_size:, checksum:, content_type: nil, metadata: nil, service_name: nil, record: nil)
create! key: key, filename: filename, byte_size: byte_size, checksum: checksum, content_type: content_type, metadata: metadata, service_name: service_name
end
Defined in activestorage/app/models/active_storage/blob.rb line 106
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Blob