Retrieve resource name from request


#1

Hi,
I was wondering if there is any way for retrieving the resource name
from the request.
Suppose I have the following resource definition in my routes.rb file:

map.resources :pages, :controller => ‘documents’

now, when the url /pages/ is requested with the GET method, the method
‘index’ in the DocumentsController will be called and the resource name
I would like to retrieve is :pages

I know I could probably do this from the URI, but in case the :as option
is used it wouldn’t work anymore:

map.resources :pages, :controller => ‘documents’, :as => ‘foo’

Now, when the url /foo/ is called, the method index in the
DocumentsController will be also called but the resource name should
still be :pages

Any hint?

I looked at the ActionController::Routes classes but didn’t find
anything useful…

Thanks in advance


/**