The Rails routing system works in two ways: it recognizes and creates URLs. You need a recognition method, as shown in the following example:
ActionController::Routing::Routes.recognize_path('/mycontroller/myaction', :method => :get)
Assuming the URL was generated with something_pathor something_url, it returns:
{ :action => 'myaction', :controller => 'mycontroller' }
From which you can extract part of the action.
Veger source
share