0
Ruby 1.9.3 Rails 3.2.11。我需要ails zip库,但不知道如何去做。这是我的代码,我只需要在一个控制器中的单个动作。Rails 3.2在哪里以及如何要求zip库
file_name = "natfiles.zip"
t = Tempfile.new("temp_natfiles")
Zip::ZipOutputStream.open(t.path) do |z|
z.put_next_entry('NAT00010')
z.print IO.read("tmp/nat00010")
end
send_file t.path, :type => 'application/zip',
:disposition => 'attachment',
:filename => file_name
t.close