Forum: Ruby on Rails Path problem after deployment

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
63d51e025f46a3e37f700b9fa949eb25?d=identicon&s=25 yi (Guest)
on 2007-02-20 23:58
(Received via mailing list)
I have my first RoR app deployed on a hosting server using CGI: making
a simlink in ~/public_html to the "public" directory of my rails app.

Everything works fine except that the app can only read/write any file
'RAILS_ROOT/public' directory. For example, on my development machine
I use 'public/images/filename.jpg' to access image files, but on the
hosting server I get errors like "unable to open image 'public/images/
filename.jpg': No such file or directory". The file actually exists
but the app seems to be navigating the relative path from 'RAILS_ROOT/
public' instead of RAILS_ROOT. I can change the path string in my code
so that the app can run correctly on the hosting server, but that way
I won't be able to run it on my development computer.

This directoy access problem only happens in .rb files, for example
uploading a picture and saving it to 'public/images'. In rthml files
everyting is just fine.

Does this have anyting to do with the setting of RAILS_ROOT?

This topic is locked and can not be replied to.