Jake Scruggs

writes ruby/wears crazy shirts

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.

1 comments :

jason said...

OK how about if you wanted to find out what the nested resources were?

/categories/1/products/3

So instead of returning just "product", it might return "[category, product]"

Is that similar?