fix courselist

This commit is contained in:
yanxd 2014-04-15 14:33:19 +08:00
parent 31ce41a2d7
commit bde4e0f4f7
2 changed files with 28 additions and 3 deletions

View File

@ -7,7 +7,8 @@ class TestController < ApplicationController
bid.homeworks.each do |homeattach|
homeattach.attachments.each do |attach|
homeworks_attach_path << attach.disk_filename
length = attach.storage_path.length
homeworks_attach_path << attach.diskfile.to_s.slice((length+1)..-1)
end
end
@paths = homeworks_attach_path
@ -28,9 +29,9 @@ class TestController < ApplicationController
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
input_filename.each do |filename|
zipfile.add(filename, folder + '/' + filename)
zipfile.add(filename.split('/').last, folder + '/' + filename)
end
zipfile.get_ouput_stream("ReadMe"){ |os|
zipfile.get_output_stream("ReadMe"){ |os|
os.write "Homeworks"
}
end

24
lib/tasks/rubyzip.rake Normal file
View File

@ -0,0 +1,24 @@
desc "nyan ruby zip operation"
task :zip do
puts "will building zip tmp files sweeper."
end
namespace :zip do
desc "ruby zip sweeper"
task :rubyzip_clean do
puts "ruby zip sweeping..."
end
end
desc "create tmp file, to test"
file 'tmp/test.yml' do
require 'yaml'
var = {
:name => "name",
:age => "age",
:agent => "agent"
}
File.open('tmp/test.yml', 'w') do |f|
f.write YAML.dump({'conf' => var })
end
end