generate functionWed, 01 Mar 2023

rails download from url & create ActiveStorage::Blob

def create_blob_from_url(url) ActiveStorage::Blob.new( key: SecureRandom.uuid, filename: File.basename(url), content_type: http_content_type(url), byte_size: http_byte_size(url), checksum: http_checksum(url) ) end

Want to kickstart your project?Use the new AI Studio to create your code