Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku with sinatra does not have RAILS_ROOT or Rail.root

I'm trying to upload file to amazon s3 and apparently I have to write to a temp file first then upload that file. But I cannot figure it out how to do that with Sinatra and heroku since it cannot find "#{RAILS_ROOT}" or #{Rail.root} how do I upload temp file to sinatra with heroku.

Thanks

like image 282
toy Avatar asked Jan 20 '12 18:01

toy


1 Answers

I'm assuming you have read through Heroku's docs for Uploading to S3. The temp directory path on Heroku is ./tmp. If you are running Sinatra, Heroku likely does not create the environment variables related to Rails (although it may, I'm not sure). Here is more info on Heroku's file system.

EDIT: In Sinatra, you can get the root directory via settings.root, similar to RAILS_ROOT.

like image 138
Paul Hoffer Avatar answered Sep 22 '22 10:09

Paul Hoffer