I have an app hosted @ Heroku. The app depends on some feeds which are fetched using a socket listener. The socket listener gets one line of XML per second. Once I detect th
The documentation on Heroku's read-only file system explains that you can use #{RAILS_ROOT}/tmp
but doesn't give any examples for generating a temporary filename. This will guarantee uniqueness of the filename:
prefix = 'mydata'
suffix = '.xml'
Tempfile.new [prefix, suffix], "#{Rails.root}/tmp"
Note that "there is no guarantee that this file will be there on subsequent requests (although it might be), so this should not be used for any kind of permanent storage."