diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb index f16eb939a..bd591896d 100644 --- a/app/controllers/test_controller.rb +++ b/app/controllers/test_controller.rb @@ -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 diff --git a/app/views/test/courselist.html.erb b/app/views/test/courselist.html.erb index b078c85a8..7805283d4 100644 --- a/app/views/test/courselist.html.erb +++ b/app/views/test/courselist.html.erb @@ -27,7 +27,7 @@ <%= link_to "package", test_zip_path(:homework_id => homework.id)%>
<% homework.homeworks.each do |homeattach|%><%#homework.class == Bid %> <% homeattach.attachments.each do |attach|%> - <%= link_to_attachment attach, author: true %> (<%=attach.author%>) + <%= link_to_attachment attach, author: true, :download => true %> (<%=attach.author%>)
<% homeworks_attach_path << attach.storage_path %> <% end %>