# Problem with send\_data and csv file produced

**URL:** <https://www.ruby-forum.com/t/problem-with-send-data-and-csv-file-produced/95115>\
**Category:** Rails\
**Created:** [May 22, 2006, 10:44am UTC](https://www.ruby-forum.com/t/problem-with-send-data-and-csv-file-produced/95115 "2006-05-22T10:44:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![burninglegion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3bc359/32.png) [@burninglegion](https://www.ruby-forum.com/u/burninglegion)\
**Post date:** [May 22, 2006, 10:44am UTC](https://www.ruby-forum.com/t/problem-with-send-data-and-csv-file-produced/95115/1 "2006-05-22T10:44:10Z")

</div>

hi, i did a search and couldn’t find wat’s the problem with my code…  
it seems everything is the same and the result is what i expected but i  
am not sure where went wrong…

using send\_data function to send the csv file to the client, the file  
sending is successfully but when i opened the csv file, something is  
wrong…

every statement got a “…” inverted commas!!! omg!!! how to get  
rid of them!! the data is correct just the why come there is the  
inverted commas!! any pro in RoR pls!! help me!!

here is a snippet of the code …

report = String.new  
array\_csv = Array.new  
@csv\_record = Model.find\_all  
CSV::Writer.generate(report, ‘,’) do |csv|  
@csv\_record.each do |record|  
record.attributes.each { |key,value| array\_csv.push “#{value}”}  
csv \<\< [array\_csv.join(’,’)]  
array\_csv.clear  
end  
end  
report.rewind  
send\_data(report.read,  
:type =\> ‘text/csv; charset=iso-8859-1;header = present’,  
:filename =\> ‘report.csv’)

this is quite standard as i compared with the others… i didnt include  
the dispostion option as it is default to :attachment… is there  
anything wrong with it???

---

<div class="post-metadata">

**Author:** ![burninglegion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3bc359/32.png) [@burninglegion](https://www.ruby-forum.com/u/burninglegion)\
**Post date:** [May 22, 2006, 10:55am UTC](https://www.ruby-forum.com/t/problem-with-send-data-and-csv-file-produced/95115/2 "2006-05-22T10:55:43Z")

</div>

oh… haha… a bad mistake… it is caused by the join function at the  
array\_csv…

thanks for anyone that is solving it…
