Sha256: ef30d7df685c0b083923bda7e34b734e85bd4e2e824d192f879b98065e69a86a
Contents?: true
Size: 1.1 KB
Versions: 7
Compression:
Stored size: 1.1 KB
Contents
require "active_storage/blob" require "active_storage/attachment" require "action_dispatch/http/upload" require "active_storage/patches/delegation" # Abstract baseclass for the concrete `ActiveStorage::Attached::One` and `ActiveStorage::Attached::Many` # classes that both provide proxy access to the blob association for a record. class ActiveStorage::Attached attr_reader :name, :record def initialize(name, record) @name, @record = name, record end private def create_blob_from(attachable) case attachable when ActiveStorage::Blob attachable when ActionDispatch::Http::UploadedFile ActiveStorage::Blob.create_after_upload! \ io: attachable.open, filename: attachable.original_filename, content_type: attachable.content_type when Hash ActiveStorage::Blob.create_after_upload!(attachable) when String ActiveStorage::Blob.find_signed(attachable) else nil end end end require "active_storage/attached/one" require "active_storage/attached/many" require "active_storage/attached/macros"
Version data entries
7 entries across 7 versions & 1 rubygems