开发者

FasterCSV (seemingly) not working in Rails 3.0.5

I am trying to export dat开发者_StackOverflowa from a rails app and have the user download a CSV file when they hit a certain controller#action.

I found this article and used the sample code exactly. http://oldwiki.rubyonrails.org/rails/pages/HowtoExportDataAsCSV

I do, in fact, get a CSV file, but within it, there is only one line of output:

#<Proc:0x00000001032c6808@/PATH_CRAP/app/controllers/reports_controller.rb:35>

Here are lines 35, 36 and 37 from the file in question.

  render :text => Proc.new { |response, output|
    csv = FasterCSV.new(output, :row_sep => "\r\n") 
    yield csv

I am using Rails 3.0.5 and added the following to my Gemfile:

gem 'fastercsv'

What gives?


render :text => proc {...} does not work in Rails 3. For the replacement, see this question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜