Module: Lockbox::ActiveStorageExtensions::CreateOne
- Defined in:
- lib/lockbox/active_storage_extensions.rb
Instance Method Summary collapse
Instance Method Details
#initialize(name, record, attachable) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/lockbox/active_storage_extensions.rb', line 70 def initialize(name, record, attachable) # this won't encrypt existing blobs # ideally we'd check metadata for the encrypted flag # and disallow unencrypted blobs # since they'll raise an error on decryption # but earlier versions of Lockbox won't have it attachable = Lockbox::Utils.encrypt_attachable(record, name, attachable) if Lockbox::Utils.encrypted?(record, name) && !attachable.is_a?(ActiveStorage::Blob) super(name, record, attachable) end |