Permalink
Browse files

Use correct csv generation method for ruby 1.9.x

  • Loading branch information...
1 parent 2a09b14 commit d14125fad86d957c237b2bc30b41572b47c3ea62 @jamesu committed Oct 5, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 app/controllers/feed_controller.rb
@@ -209,18 +209,18 @@ def export_times
end
format.csv do
- build_str = ''
- CSV.generate_row(['Project', 'Date (UTC)', 'Attributed to', 'Hours', 'Name', 'Description', 'Task list', 'Task'], 8, build_str)
- @times.each { |time| CSV.generate_row([time.project.name,
+ build_str = CSV.generate do |csv|
+ csv << ['Project', 'Date (UTC)', 'Attributed to', 'Hours', 'Name', 'Description', 'Task list', 'Task']
+ @times.each { |time| csv << [time.project.name,
time.running? ? '' : time.done_date.strftime('%m/%d/%Y'),
time.assigned_to.nil? ? 'Anyone' : time.assigned_to.display_name,
time.hours,
time.name,
time.description,
time.task_list.nil? ? '' : time.task_list.object_name,
time.task.nil? ? '' : time.task.object_name,
- ], 8, build_str) }
-
+ ] }
+ end
render :text => build_str, :content_type => 'application/vnd.ms-excel'
end
end

0 comments on commit d14125f

Please sign in to comment.