Geroku with Sinatra does not have RAILS_ROOT or Rail.root

I am trying to upload a file to amazon s3 and apparently I need to write to temp file first and then upload this file. But I can’t figure out how to do this with Sinatra and heroku, since it cannot find "# RAILS_ROOT" or # {Rail.root} how to load the temp file into sinatra using heroku.

thank

+5
source share
1 answer

I assume you have read Heroku docs for Download on S3 . The temp directory trace on Heroku is ./tmp. If you use Sinatra, Heroku probably does not create environment variables related to Rails (although this may be, I'm not sure). Here is more information about the Heroku file system.

EDIT: in Sinatra, you can get the root directory using settings.root, similar RAILS_ROOT.

+10
source

All Articles