Routing Problems

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: http://it.docs.yahoo.com/nowyoucan.html

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