Module: Lockbox::ActiveStorageExtensions::AttachedOne

Defined in:
lib/lockbox/active_storage_extensions.rb

Instance Method Summary collapse

Instance Method Details

#attach(attachable) ⇒ Object



54
55
56
57
# File 'lib/lockbox/active_storage_extensions.rb', line 54

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

#rotate_encryption!Object



59
60
61
62
63
64
65
# File 'lib/lockbox/active_storage_extensions.rb', line 59

def rotate_encryption!
  raise "Not encrypted" unless encrypted?

  attach(rebuild_attachable(self)) if attached?

  true
end