Ruby on Rails: Get the controller and action name based on a path

Viewed 15320

I am trying to get the controller and action name based on a path. I have a route:

map.resources :permissions

I thought that I could use:

ActionController::Routing::Routes.recognize_path "/permissions/1"

To get a hash like:

{ :controller => "permissions", :action => "show" }

The actual hash that comes back is:

{ :controller => "permissions", :action => "1" }

How do I get the correct action name instead of just my passed in ID? The dispatcher must be able to get at it somehow or Rails wouldn't work, but I am having trouble locating how it is accomplished.

3 Answers
Related