For master branch of rails/rails (http://edgeguides.rubyonrails.org/active_storage_overview.html#downloading-files):
message.video.open do |file|
system '/path/to/virus/scanner', file.path
# ...
end
For Rails 5.2:
def process_zip
# Download the zip file in temp dir
zip_path = "#{Dir.tmpdir}/#{zip.filename}"
File.open(zip_path, 'wb') do |file|
file.write(zip.download)
end
Zip::File.open(zip_path) do |zip_file|
# process the zip file
# ...
puts "processing file #{zip_file}"
end
end
Source: https://www.reddit.com/r/rails/comments/7hr7la/getting_file_image_path_with_activestorage/