Routes?

The images in my program aren't appearing. They're all housed in
public/images so I was hoping that I could modify routes.rb to point
the program in the right direciton.

The page that has the images has the typical image html code:

<img src="images/barb1.png">

Now I know that if I add a '/' in front of images, the image will show
up, but this page has approximately 100 pictures generated
automatically by a program every time it's called and I'd rather do
this painlessly.

Looking at the picture's property, the pictures are pointed at "http://
localhost:3000/[controller]/images/barb1.jpg" when it should be
"http://localhost:3000/images/barb1.jpg"

I know squat about routes despite reading Agile Web Development with
Rails, two other relatively thick books, and multiple articles on the
web. I've tried many different ways to define the routes in hopes of
stumbling on the answer, but have failed thus far so I have turned to
this awesome commnuity.

Any help would be appreciated with suggestions on what the correct
code is to put in routes.rb

Thanks,
Anon_comp

Ignore. Problem solved.
Anon_comp

Can you share how you solved it? Am facing a similar situation.

Can you share how you solved it? Am facing a similar situation.

Sure thing.

This may or may not be your situation considering that my page was an
outside-program-generated .html page.

If it is then all you have to do is move the page to the public
folder. You can put it in it's own folder and have an "images" folder
within that folder so the page can find the images (ie. public\hello
\images). Or just leave the page under the public folder and place the
images in "public\images"

I wish you luck :slight_smile:

Doesn't <%= image_tag('some_image.png') %> always produce an image tag
pointing to /images/some_image.png regardless of which view it is
being called from?

Yes it does, but read the paragraphs before that to see that the
rendered page uses a normal html img call and that it occurs about 100
times. But your suggestion is completely correct :slight_smile:

So you're saying that you don't have control over the image tags that
are being generated in your views? That sounds like a bad position to
be in. I have no idea how you would go about manipulating the routing
to redirect calls to image files. What is generating the image tags?

Yes, I don't have control over the image tags that are being
generated. I didn't need to route; it was simply a relocation issue.
The problem has been fixed and this thread is closed, but I do
appreciate that you are willing to give help. Although...there is
another person who may seek your help by the name of "Arun Srini" so
just keep an eye out for his/her post from now on.