views:

43

answers:

1

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.

A: 

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.

bjeanes
Ah, I forgot to mention that the image is not being displayed because the resource can not be located. I updated my question to reflect this.
SooDesuNe
I entirely suspect something else is wrong then. If the image isn't 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, I bet. Are you sure you committed the image to your repository?
bjeanes
Sounds reasonable, but a check of the repo shows the file is present. See my update for details
SooDesuNe
Upon closer inspection...these are loafers. Also you are correct bjeanes. I had the wrong case on my filename. Please update your answer, so I can mark it correct
SooDesuNe
I've updated the answer now
bjeanes