# CSV Export error

**URL:** <https://discuss.rubyonrails.org/t/csv-export-error/58736>\
**Category:** rubyonrails-talk\
**Created:** [April 30, 2011, 7:04pm UTC](https://discuss.rubyonrails.org/t/csv-export-error/58736 "2011-04-30T19:04:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bertly\_the\_coder](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@bertly\_the\_coder](https://discuss.rubyonrails.org/u/bertly_the_coder)\
**Post date:** [April 30, 2011, 7:04pm UTC](https://discuss.rubyonrails.org/t/csv-export-error/58736/1 "2011-04-30T19:04:19Z")

</div>

Hi guys, When I export data into a .csv file, it works perfectly. when I push the code to heroku, I get the following error: ActionView::Template::Error (can't convert Hash into String):

My helper to generate the csv is: def generate\_csv &nbsp;&nbsp;&nbsp;csv\_str = CSV.generate(:col\_sep =\> ",") do |csv| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Entrant.find(:all).each do |entrant| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csv \<\< [entrant.firstname, entrant.lastname, entrant.email, entrant.entrydate] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end

Is there any reason why I would get this error?

Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [April 30, 2011, 9:19pm UTC](https://discuss.rubyonrails.org/t/csv-export-error/58736/2 "2011-04-30T21:19:45Z")

</div>

> Hi guys, When I export data into a .csv file, it works perfectly. when I push the code to heroku, I get the following error: ActionView::Template::Error (can't convert Hash into String):

Are you running the same ruby version locally and in production ? This looks like it might be a ruby 1.8 vs 1.9 thing (the csv library was rewritten for 1.9)

Fred
