SooDesuNe
SooDesuNe

Reputation: 10030

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.

Upvotes: 3

Views: 1065

Answers (1)

Bo Jeanes
Bo Jeanes

Reputation: 6383

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.

Upvotes: 3

Related Questions