"reverse" routes - getting a controller and action from a URL

I'm using redirect_to :back in my app in one place. In a couple cases
I need to see if the http referrer is a certain controller/action
pair, and do something differently based on that. Is there some way
to get the url options from a url string?

Pat

Pat,

You want to take a look at
ActionController::Routing::Routes.recognize_path

I don't know if you have the Pragmatic Agile book, 2nd edition. If
so, check out page 398 (chapter 20, "Action Controller: Routing and
URLs"). If not, check out this example from my console:

ActionController::Routing::Routes.recognize_path "/users"

=> {:controller=>"users", :action=>"index"}

ActionController::Routing::Routes.recognize_path "/users/5"

=> {:controller=>"users", :action=>"5"}

ActionController::Routing::Routes.recognize_path "/users/5", :method => :get

=> {:controller=>"users", :action=>"show", :id=>"5"}

ActionController::Routing::Routes.recognize_path "/users/5", :method => :put

=> {:controller=>"users", :action=>"update", :id=>"5"}

ActionController::Routing::Routes.recognize_path "/users", :method => :post

=> {:controller=>"users", :action=>"create"}