Module: Lockbox::ActiveStorageExtensions::AttachedOne

Defined in:
lib/lockbox/active_storage_extensions.rb

Instance Method Summary collapse

Instance Method Details

#attach(attachable) ⇒ Object



23
24
25
26
# File 'lib/lockbox/active_storage_extensions.rb', line 23

def attach(attachable)
  attachable = encrypt_attachable(attachable) if encrypted?
  super(attachable)
end

#rotate_encryption!Object



29
30
31
32
33
34
35
# File 'lib/lockbox/active_storage_extensions.rb', line 29

def rotate_encryption!
  raise "Not encrypted" unless encrypted?

  attach(Utils.rebuild_attachable(self)) if attached?

  true
end