Module: Lockbox::ActiveStorageExtensions::Attachment

Extended by:
ActiveSupport::Concern
Defined in:
lib/lockbox/active_storage_extensions.rb

Instance Method Summary collapse

Instance Method Details

#downloadObject



93
94
95
96
97
98
99
100
101
102
# File 'lib/lockbox/active_storage_extensions.rb', line 93

def download
  result = super

  options = Utils.encrypted_options(record, name)
  if options
    result = Utils.build_box(record, options, record.class.table_name, name).decrypt(result)
  end

  result
end

#mark_analyzedObject



104
105
106
107
108
# File 'lib/lockbox/active_storage_extensions.rb', line 104

def mark_analyzed
  if Utils.encrypted_options(record, name)
    blob.update!(metadata: blob..merge(analyzed: true))
  end
end