I recommend sticking with absolute paths. Life is always easier that way.

So the correct path would be '/images/IMAGE-NAME.jpg'. But with the Rails image helper, you can leave out the images directory, like so:

<%= image_tag (IMAGE-NAME.jpg) %>

Too, if you are using subdirectories in /images, you can do this:

<%= image_tag (SUBDIRECTORY/IMAGE-NAME.jpg) %>

-- Patrick


On Feb 21, 2007, at 12:43 pm, Kevin Burk wrote:

I'm having some difficulty with specifying image paths in my application. I have a general layout template for my model that has relative reference urls to the images (../images/IMAGE-NAME.jpg). This works for the index view, but when I invoke the show view (which lives in the same folder as the index view, and should have the same relative path for the images), the image urls are broken....the show view, when invoked from the index view wants the path of "../../images/IMAGE-NAME.jpg" to display the images in the template correctly.

This doesn't seem to make sense to me. The model folders are all the same distance from the public/images folder. It shouldn't matter which view I invoke, right?

How do I correct this?

Thanks,

Kevin Burk
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to