Module: Lockbox::ActiveStorageExtensions::Attachment

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

Instance Method Summary collapse

Instance Method Details

#downloadObject



105
106
107
108
109
110
111
112
113
114
# File 'lib/lockbox/active_storage_extensions.rb', line 105

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



116
117
118
119
120
# File 'lib/lockbox/active_storage_extensions.rb', line 116

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