Topic: Routes: tracking which route was taken

Hi,

In my project, I have a big route file.
So I want to track which route in the route file was taken.

Can the route from routes.rb file be displayed somewhere.

Can some configuration be done for this ?

I think this can make debugging faster and easier..

Re: Routes: tracking which route was taken

you can call rake:routes just to get an idea of exisiting urls and routes

Re: Routes: tracking which route was taken

that is fine

It gives all the routes

What I want is

When I click on any link or button -> then the only route which was taken should  displayed at the screen.

Re: Routes: tracking which route was taken

Even if you put your mouse pointer on a link or a button you can see the url it correponds to. Moreover you can check either in your console in DEV mode or in both DEV and PROD modes in log files.

Re: Routes: tracking which route was taken

What do you mean  by

When I click on any link or button -> then the only route which was taken should  displayed at the screen.

If it's not AJAX request you'll always see the url in you browser address , no?

Re: Routes: tracking which route was taken

Thank you for replies but I think ,

I should have taken an example to explain

here is what I want........
MY ROUTE FILE IS :

##########################################
map.connect '/ads/', :controller=>'ads', :action=>'index'
  map.connect '/ads/new', :controller=>'ads', :action=>'new'
  map.connect '/ads/create', :controller=>'ads', :action=>'create'

  map.connect '/ads/:id/update', :controller=>'ads', :action=>'update'
  map.connect '/ads/:id/edit', :controller=>'ads', :action=>'edit'
  map.connect '/ads/:id/delete', :controller=>'ads', :action=>'delete'
  map.connect '/ads/:id', :controller=>'ads', :action=>'show'
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
##########################################

suppose I click on a link having URL(visible on browser as said by JAVIX , true )  as -> 

"http://localhost:3030/ads/23/edit "

now when this URL is accessed, it is clearly accessing the route "map.connect '/ads/:id/edit', :controller=>'ads', :action=>'edit'"

I want to have my output as

                                         map.connect '/ads/:id/edit', :controller=>'ads', :action=>'edit'

##############################################################################

This is a simpler example, with a smaler route file ,

but when we are working with a route file which has hundreds of routes, this can help a lot..

The output need not be visible to end user but should be visible on SERVER LOG or any other internal log.......

I hope my query is clear enough now ...............

Hoping for reply..........

Last edited by saurabh (2009-11-11 03:35:48)