Links to images keep breaking


I have a catalog that has images in it. The images are stored in

When I open the catalog via the catalog controller I get this url:

for the images and they display correctly.

When I link to the catalog from another controller and view I get this:

If I attempt to put and image in to a view, I get this url:

To display the images I am using this code: and the url stored in image_s is: ‘images/sow/sow.jpg’

Any suggestions on how to sort this out, would be most welcome.



fyi, this has nothing to do with rails, but with the use of relative
vs absolute URLs and the browser.

since you are using a relative path to the image, your browser is
attempting to create the absolute path based on the URL of the

so if you follow a URL such as:

and there is an image tag in that document such as

your browser will actually assume the image’s absolute URL is

so you will want to use a “/” at the beginning of your images src path

to indicate to the browser that the images directory starts from the

instead of

hope this helps.

Thanks Chris, that cleared that one up for me.



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs