[ACCEPTED]-FileTest.exists? issue with ruby on rails-file
I'm guessing it's because you're asking 7 whether a file "header.jpg" exists in a 6 directory "images" off of the root directory 5 for your system (which on Windows I'd assume 4 is "c:\"). Try putting the full path (from 3 the filesystem root) to the "/images" directory 2 rather than the URL path.
In particular, as 1 pointed out by @Brian, you should use:
FileTest.exists?(RAILS_ROOT + "/images/header.jpg") # < rails 3.0 FileTest.exists?(Rails.root + "/images/header.jpg") # >= rails 3.0
RAILS_ROOT to the filename that you're checking 1 before calling exists?
More Related questions