I’m writing a website with a feature that hosts images that people
Right now, relative paths works within on my Windows box. So
specifically, I’m able to call File.open on
“public/images/somefile.jpg” and Rails/WEBrick understands that the
path is relative to the home directory of the project. This means that
“public/images/somefile.jpg” ends up referring to the absolute path
The problem is now I’ve pushed this out to a Linux box running
Lighty/FastCGI and I get the error Errno::ENOENT with message:
“No such file or directory - public/images/somefile.jpg”
I found that if I prepend the public with the actual path - so,
the entire setup works.
Any ideas on the best way to approach this?
In particular, a couple ways to fix this:
- Is there a method that returns the home directory of the app?
- Is there a method which complements image_path and tells me the file
system location of where a file should be saved?
- Is there a switch to force Rails to understand relative paths?
Let me know if you guys have any ideas.
Thanks in advance!
(from Seattle, WA)