简体   繁体   中英

Heroku: RAILS_ROOT returns app folder instead of root folder

I have this RoR app that calls to RAILS_ROOT. When running it using rails server (or when checking with ./script/console ) the value contains the app's root. When deploying and running it with Heroku, however (or when checking with heroku console ), the returned path is '/app'.

Why's that?

Thanks

Because on heroku your app is in the /app folder (from the root / ). It is NOT the app folder of your application, which is /app/app .

The file structure is:

/app/app/...
/app/config/..
/app/Gemfile
...

You can make an experiment.

Run heroku console and discover the file structure.

> heroku console
> puts `ls`
> puts `pwd`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM