From: Ajit Teli Date: 2011-12-12T14:24:25+09:00 Subject: after downloading showing empty file def export_rawdata @device = Device.find_by_id( params[:id] ) @messages = @device.devmessages.all( :order => "id", :conditions => ["packettime >= ? and packettime <= ?", params[:start_time], params[:end_time]] ) raw_data_path = "#{Rails.root}/tmp/exports/#{@device.s_dev_name}.csv" File.open(raw_data_path, "w+") do |csv| csv.write ["Packet","Created At"] @messages.each_with_index do |m,i| x = m.created_at csv.write [m.message, x.strftime('%h %d, %G %r')] end end send_file raw_data_path, :type => "application/zip", :x_sendfile => true end Able to store the data file in a tmp/exports But when i click on download , it is downloading the empty file. What is the mistake i have done in my code? -- Posted via http://www.ruby-forum.com/.