Module: Lockbox::ActiveStorageExtensions::AttachedOne

Defined in:
lib/lockbox/active_storage_extensions.rb

Instance Method Summary collapse

Instance Method Details

#attach(attachable) ⇒ Object



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

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

#rotate_encryption!Object



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

def rotate_encryption!
  raise "Not encrypted" unless encrypted?

  attach(rebuild_attachable(self)) if attached?

  true
end