Heroku - how to write into “tmp” directory?

后端 未结 2 1847
闹比i
闹比i 2021-01-01 21:57

I need to use the tmp folder on Heroku (Cedar) for writing some temporarily data, I am trying to do that this way:

open(\"#{Rails.root}/tmp/#{re         


        
2条回答
  •  鱼传尺愫
    2021-01-01 22:25

    Is /tmp included in your git repo? Removed in your .slugignore? The directory may just not exist out on Heroku.

    Try tossing in a quick mkdir before the write:

    Dir.mkdir(File.join(Rails.root, 'tmp'))
    

    Or even in an initializer or something...

提交回复
热议问题