If you use Tempfile
and pass your own filename containing an extension, it will just be consumed by the Tempfile's filename:
>> Tempfile.new('foobar.xlsx').path
=> "/tmp/foobar.xlsx20130115-19153-4ykpwm-0"
If you want to keep the file extension, pass filename and extension as an array:
>> Tempfile.new([ 'foobar', '.xlsx' ]).path
=> "/tmp/foobar20130115-19153-1xhbncb-0.xlsx"
Posted by Arne Hartherz to makandra dev (2013-01-15 15:40)