Class: ActiveStorage::FixtureSet

Inherits:
Object
  • Object
show all
Defined in:
lib/uuid_attribute/railtie.rb

Class Method Summary collapse

Class Method Details

.blob(filename:, **attributes) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/uuid_attribute/railtie.rb', line 37

def self.blob(filename:, **attributes)
  generated_uuid = Digest::UUID.uuid_v5(Digest::UUID::OID_NAMESPACE, filename)
  raw_uuid = UuidAttribute::Utils.raw_bytes(
    UuidAttribute::Utils.normalize(UuidAttribute::Utils.parse(generated_uuid))
  )
  new.prepare Blob.new(filename: filename, id: raw_uuid, key: generated_uuid), **attributes
end