Hi, I’m having a problem with the routing within my rails app. I’m probably doing something completely, obviously, and totally wrong, but for the life of me I can’t see it.
The short of it: My banner disappears if my url goes beyond displaying the controller name.
Case in point:
the banner displays correctly when viewing the home page
Hi, I'm having a problem with the routing within my rails app. I'm probably
doing something completely, obviously, and totally wrong, but for the life
of me I can't see it.
The short of it: My banner disappears if my url goes beyond displaying the
controller name.
To help simplify the problem I removed the css file and hard coded the
banner into the div:
<div id="logo" style="width: 700px;background-image:
url(../images/logo1.png)">
make it like this: url(/images/logo1.png)
The "../" makes it relative to the url you are at.
Which is exactly what you're seeing. Just make the url reference absolute (ie. start it with a '/') and you'll be fine. I'd recommend doing this for *all* your assets (images, javascript, stylesheets, etc.)
Hi Joe, could you provide a snippet of code (i.e. Ruby template) that
contains the image? In any case, you should be referencing images in
you templates as follows:
/images/some_image.image_extension
I was faced with this same issue last night because the pages where using
images/some_image.image_extension
which was an incorrect usage and was referring to a different
directory on my server.