views:

52

answers:

2

I used rake routes to print out all of the routes in my application.

What I found is that a couple of routes map to the same controller/action combination.

So in my action I would like to display which route was actually used to track down where everthing is coming from.

I tried just rendering params.inspect as text:

render :text => params.inspect

But I don't get the route information in the hash.

Is there some other command to reveal the currently used route from within the action?

+1  A: 

I think you can use

request.url or params[:action] or params[:controller] depending on what you need.

Jim
Unless you're using subclassed controllers, Params :action/:controller are obvious given where the code is called from. They're more useful in views that can be called from multiple controllers. request.url is the correct answer.
EmFi
A: 
request.url

This will tell you the route that caused your current action to be invoked.

ski