Module: Lockbox::ActiveStorageExtensions::AttachedOne

Defined in:
lib/lockbox/active_storage_extensions.rb

Instance Method Summary collapse

Instance Method Details

#attach(attachable) ⇒ Object



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

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

#rotate_encryption!Object



44
45
46
47
48
49
50
# File 'lib/lockbox/active_storage_extensions.rb', line 44

def rotate_encryption!
  raise "Not encrypted" unless encrypted?

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

  true
end