Skip to content

Instantly share code, notes, and snippets.

View prog1dev's full-sized avatar

Ivan prog1dev

View GitHub Profile
@prog1dev
prog1dev / gist:62660be194ce4aec73721a0af1665983
Last active April 29, 2020 12:48
download_zip method without temp files
def download_zip(image_list)
unless image_list.blank?
file_name = 'pictures.zip'
stringio = Zip::ZipOutputStream::write_buffer do |z|
image_list.each do |img|
title = img.title
title += '.jpg' unless title.end_with?('.jpg')
z.put_next_entry(title)