|
|
|
@ -7,7 +7,7 @@ class TestController < ApplicationController
|
|
|
|
|
|
|
|
|
|
bid.homeworks.each do |homeattach|
|
|
|
|
|
homeattach.attachments.each do |attach|
|
|
|
|
|
homeworks_attach_path << attach.diskfile
|
|
|
|
|
homeworks_attach_path << attach.disk_filename
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@paths = homeworks_attach_path
|
|
|
|
@ -22,16 +22,16 @@ class TestController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def ziping files_path
|
|
|
|
|
folder = "/tmp"
|
|
|
|
|
folder = "#{Rails.root}/files"
|
|
|
|
|
input_filename = files_path
|
|
|
|
|
zipfile_name = "/tmp/archive_#{Time.now.to_i}.zip"
|
|
|
|
|
zipfile_name = "#{Rails.root}/tmp/archive_#{Time.now.to_i}.zip"
|
|
|
|
|
|
|
|
|
|
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
|
|
|
|
input_filename.each do |filename|
|
|
|
|
|
zipfile.add(filename, folder + '/' + filename)
|
|
|
|
|
end
|
|
|
|
|
zipfile.get_ouput_stream("ReadMe"){ |os|
|
|
|
|
|
os.write "myFile contains just this"
|
|
|
|
|
os.write "Homeworks"
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
zipfile_name
|
|
|
|
|