Sha256: c28b6a67c000f5d30d7e848d510761e1298c167d117246326f1bfdd3d21118d6
Contents?: true
Size: 614 Bytes
Versions: 3
Compression:
Stored size: 614 Bytes
Contents
module EffectiveLogging module ActiveStorageLogger def track_downloads user = current_user if respond_to?(:current_user) key = decode_verified_key() return unless key.present? blob = ActiveStorage::Blob.where(key: key[:key]).first return unless blob.present? blob.attachments.each do |attachment| associated = attachment.record filename = blob.filename.to_s message = [associated.to_s, filename.to_s].uniq.join(' ') EffectiveLogger.download(message, associated: associated, filename: filename, user: user) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems