def self.make_zip_io
  cmd = "sh -c 'cd /somewhere && zip -r - stuff'"
  IO.popen(cmd)
end

def zip
  io = self.class.make_zip_io
  send_data(io.read, :filename => 'filename.zip', :type => 'application/zip')
end