Topic: Doc (and books) about layout image search path wrong?

Hi all!

I am a RoR newbie (but have been programming since computers used vacuum tubes and drum memory, and no, I didn't go to school with Abe Lincoln).

I just setup a really nice application.rhtml layout for a rails project and put all of the images under project_root/public/images, which is where the documentation and books imply that it should go.  The controller involved references "users".

When the browser looks for the images it is looking in project_root/user, not project_root/public/images.

Have I misunderstood something?  Is the documentation wrong?  Or is there a <gasp> bug in Rails?



Re: Doc (and books) about layout image search path wrong?

How are you inserting the url for the images into your template? It sounds as if you might be using one of the link_to methods which would make it assume a controller type url instead of the desired public image url.

My RoR journey  -- thoughts on learning RoR and lessons learned in applying TDD and agile practices.

Re: Doc (and books) about layout image search path wrong?

Well, I got it to work by inserting a link in the form "/images/image.gif"  I mis-read the docs and thought that the leading "/" would force an absolute path - which it didn't.

Now the cool layout is there for all appropriate pages.  All I have left to do is to clean up all of the copies of the images that I created while trying to find where it was looking for them.

It turns out that without the "/" it was trying to find a controller named the same as the image file (or leading directory) and leaving a lot of 404 errors in the log.

Thanks all!