I am having trouble figuring out the “right” way to specify the path
to an image when it is an attribute of something other than an image
tag.
For example, I see that image_tag(“myimage.png”) automatically knows
to look in the public/images directory.
How do I accomplish the same thing for other tags? For example, my
layout has:
Also, in my css file:
tr#logobar { background-image:url(“logo_bg.gif”) }
In these cases it seems that specifying the image name is not enough.
First, I tried a relative path (“images/logo_bg.gif”) but this failed.
A full path worked (“/images/logo_bg.gif”) worked, but this causes
problems for deployment.
My server has the application root in a subdirectory. In other words,
my application is in:
All of the places where I had “/images/logo_bg.gif” fail on the
server. I have to manually change them to “/myapp/logo_bg.gif” for
them to work.
It doesn’t seem like manually updating those links every time I want
to deploy a new version is the right way to do this.
What am I missing here?