Class: ActiveStorageSupport::Base64Many

Inherits:
ActiveStorage::Attached::Many
  • Object
show all
Defined in:
lib/active_storage_support/base64_many.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_base64(attachables) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/active_storage_support/base64_many.rb', line 7

def self.from_base64(attachables)
  attachables = [attachables] unless attachables.is_a?(Array)

  attachables.flatten.map do |attachable|
    ActiveStorageSupport::Base64Attach.attachment_from_data(attachable)
  end
end

Instance Method Details

#attach(*attachables) ⇒ Object



3
4
5
# File 'lib/active_storage_support/base64_many.rb', line 3

def attach(*attachables)
  super self.class.from_base64(attachables)
end