Reputation: 7138
How to write into a temporary file (in the temp folder of a machine) from a Rails app, I am using Spreadsheet::Workbook.new
and I want the contents to be written into a temp file
Upvotes: 0
Views: 1944
Reputation: 31467
You can use the Ruby's Tempfile
:
file = Tempfile.new('prefix')
or with a block:
Tempfile.new('prefix') do |file|
# do the work with the file
end
Upvotes: 3