# Routing Problems

**URL:** <https://www.ruby-forum.com/t/routing-problems/104293>\
**Category:** Radiant CMS\
**Created:** [May 16, 2007, 3:09pm UTC](https://www.ruby-forum.com/t/routing-problems/104293 "2007-05-16T15:09:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spliffer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@spliffer](https://www.ruby-forum.com/u/spliffer)\
**Post date:** [May 16, 2007, 3:09pm UTC](https://www.ruby-forum.com/t/routing-problems/104293/1 "2007-05-16T15:09:24Z")

</div>

Hi everybody,

I’ve developed an extension that display a list of  
links, taken from a database table, in a page of my site called  
links.

By clickking on the title of a link a “singlelink”  
page will be opened.

In this page is displayed a description of  
the link.

To select the single link I’ ve created a  
tag.

This tag pass the “link id” by the URL and another  
tag get the id from the URL and select the record from the db  
table.

This is the code of my tags:

tag  
“links:each:link\_to\_single” do |tag|  
curURL =  
request.request\_uri  
%{#{tag.locals.lnk.site\_name}}

end

tag “links:single” do |tag|  
content =  
‘’  
curId =  
request.params[‘id’]  
lnk = Link.find\_by\_id  
curId  
tag.locals.lnk = lnk

content \<\< tag.expand  
content

end

With this tags I form url like: /en/singlelink?id=2

It works  
very well, but now I’ve got problems with the cache. I’ve read some  
documents  
about Rails Caching and I’ve learned that I must form url like this:  
/en/singlelink/2.

I’ve tryed to change the tag “link\_to\_single” in this way:

tag “links:each:link\_to\_single” do  
|tag|  
curURL = request.request\_uri  
%{#{tag.locals.lnk.site\_name}}

end

But now radiant reads the id in the URL /en/singlelink/2 like a page  
slug, and it renders a page not found error.

I also tryed to modify the radiant routes.rb file adding in the part  
Site URL:

map.with\_options(:controller =\> ‘site’) do |site|  
site.singlelink ‘it/links/singlelink/:id’,  
:action =\> ‘show\_page’

But it dosen’t work.

Is there someone who can explain me how can I compose the URL passing an  
id directly after the " / " ?

Thanks everybody.

Taddei Fabrizio

```
  ___________________________________

```

L’email della prossima generazione? Puoi averla con la nuova Yahoo!  
Mail: [Yahoo Search - Ricerca nel Web | Motore di Ricerca](http://it.docs.yahoo.com/nowyoucan.html)
