ruby on rails - File.exists? is not detecting present file -


checking file file.exists? returns false in production console:

irb(main):026:0> x.avatar(:medium) => "/system/users/avatars/000/000/091/medium/linkedin.jpg?1391118203"  irb(main):025:0> file.exists? x.avatar(:medium) => false 

chrome network log indicates file found

request url:https://www.example.com/system/users/avatars/000/000/091/medium/linkedin.jpg?1391118203 request method:get status code:200 ok 

any idea why discrepancy?

update

i have tried

irb(main):029:0> file.size "#{rails.root}/public#{x.avatar(:medium)}"  errno::enoent: no such file or directory @ rb_file_s_size - /home/app/example.com/current/public/system/users/avatars/000/000/026/medium/277553f.jpg?1432666893 

file.exists? looking file on filesystem, avatar method including uri query (?1391118203) isn't part of physical file name.

i bet if chop query string off return true:

file.exists? "#{rails.root}/public#{ x.avatar(:medium).sub(/\?\d+$/, '') }" 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -