Skip to content

Instantly share code, notes, and snippets.

@clemens
Created November 25, 2010 09:39
Show Gist options
  • Save clemens/715132 to your computer and use it in GitHub Desktop.
Save clemens/715132 to your computer and use it in GitHub Desktop.
Set environment variable so that Dir::tmpdir uses another temp directory
require 'fileutils'
# force the whole app to use its own tmpdir
FileUtils.mkdir_p(Rails.root.join('tmp'))
ENV['TMPDIR'] = Rails.root.join('tmp')
@michaeljoseph
Copy link

Based on this error:

TypeError: can't convert Pathname into String

I had to change the last line to the following:

ENV['TMPDIR'] = Rails.root.join('tmp').to_s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment