Return to Snippet

Revision: 28612
at July 10, 2010 08:36 by insanedreamer


Initial Code
r = Rails.application.routes
## MyApp::Application.routes does the same thing

# list all

r.routes.each { |x| puts x }

# inspect parts:

r1 = r.routes.first
 => GET    areas:format                         {:action=>"index", :controller=>"areas"} 
r1.path
 => "/areas(.:format)" 
r1.requirements
 => {:action=>"index", :controller=>"areas"} 
r1.verb
 => "GET"

# test routes with:

r.recognize_path('/users')
=> {:action=>"index", :controller=>"users"}

Initial URL

                                

Initial Description

                                

Initial Title
Inspect and test routes in console (Rails 3)

Initial Tags

                                

Initial Language
Rails