# Routes?

**URL:** <https://www.ruby-forum.com/t/routes/189543>\
**Category:** Rails\
**Created:** [June 2, 2010, 8:32pm UTC](https://www.ruby-forum.com/t/routes/189543 "2010-06-02T20:32:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 2, 2010, 8:32pm UTC](https://www.ruby-forum.com/t/routes/189543/1 "2010-06-02T20:32:58Z")

</div>

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:

![]()

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](http://localhost:3000/images/barb1.jpg)”

I know squat about routes despite reading Agile Web D. 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

---

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 2, 2010, 10:13pm UTC](https://www.ruby-forum.com/t/routes/189543/2 "2010-06-02T22:13:04Z")

</div>

On Jun 2, 2:31 pm, anon\_comp [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> automatically by a program every time it’s called and I’d rather do  
> 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

---

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 3, 2010, 6:49am UTC](https://www.ruby-forum.com/t/routes/189543/3 "2010-06-03T06:49:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 3, 2010, 3:15pm UTC](https://www.ruby-forum.com/t/routes/189543/4 "2010-06-03T15:15:45Z")

</div>

On Jun 2, 8:31 pm, anon\_comp [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I know squat about routes despite reading Agile Web D. 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

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?

---

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 3, 2010, 2:45pm UTC](https://www.ruby-forum.com/t/routes/189543/5 "2010-06-03T14:45:53Z")

</div>

On Jun 3, 12:48 am, Arun S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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 🙂

---

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 3, 2010, 5:41pm UTC](https://www.ruby-forum.com/t/routes/189543/6 "2010-06-03T17:41:33Z")

</div>

On Jun 3, 9:14 am, Sharagoz [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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 🙂

---

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 3, 2010, 5:55pm UTC](https://www.ruby-forum.com/t/routes/189543/7 "2010-06-03T17:55:37Z")

</div>

On Jun 3, 5:40 pm, anon\_comp [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Jun 3, 9:14 am, Sharagoz [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
> 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 🙂  
> 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?

---

<div class="post-metadata">

**Author:** ![anon\_comp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/898d66/32.png) [@anon\_comp](https://www.ruby-forum.com/u/anon_comp)\
**Post date:** [June 3, 2010, 7:15pm UTC](https://www.ruby-forum.com/t/routes/189543/8 "2010-06-03T19:15:14Z")

</div>

On Jun 3, 11:54 am, Sharagoz [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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 S.” so  
just keep an eye out for his/her post from now on.
