开发者

Rails3 and heroku image_path

I'm having a problem where the asset tag time stamp is not being applied when image_path is used. As a result, the image is not displayed. This only happens when I push to heroku.

code:

<%= image_path 'notebook.png' %>

localhost result:

开发者_如何转开发
/images/notebook.png?1284326123

Heroku result:

/images/notebook.png

Heroku push output:

-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.0
       All dependencies are satisfied
       Compiled slug size is 15.4MB
-----> Launching.... done

image_tag works just fine. I suspect rails3_serve_static_assets is at fault. Any ideas?

UPDATE

A check of Heroku filesystem shows that Notebook.png does exist.

$ heroku console
Ruby console for myapp.heroku.com
>> `ls public/images`
=> "<bunch of files>\nNotebook.png\n<bunch of other files>"

And there's the problem. My code was referencing 'notebook', where the file was called 'Notebook'. Apparently localhost is more permissive than Heroku.


If the image isn't being displayed, it shouldn't have anything to do with whether or not the timestamp is there. In fact, the timestamp isn't being appended because Rails can't find that image on the disk anywhere.

As you've discovered, Heroku is case-sensitive (like most *nix systems). Windows and OS X are NOT case-sensitive and that's why it treats notebook and Notebook as the same thing on localhost.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜