Finding a Rails Route from a Path

01 Jun 2009

Fred Polgardy and I were looking up how to find out what path in the browser corresponds to what controller/action combination in a Rails application today and I realized that I’ve looked this up before… So I’m putting this information here so I can find it in the future:

(from inside the console)

> ActionController::Routing::Routes.recognize_path ‘/seo/hotness/path/705105’

=> {:controller=>”products”, :action=>”show”, :id=>”705105”}

Yeah I know you can do a ‘rake routes’ and hunt around but this gets me where I need to be quicker.