Files
old-ribica/back-office/app/helpers/items_helper.rb

14 lines
238 B
Ruby
Raw Normal View History

module ItemsHelper
2015-12-31 00:07:43 +01:00
def self.create_csv(data)
file = Tempfile.new([Rails.root.join('tmp/').to_s, ".csv"], "")
csv = CSV.new(file)
data.each do |row|
csv << row
end
2015-12-31 00:07:43 +01:00
file.rewind
file.close
file
end
end