Rick Olson’s released a Routing Navigator plugin to help understand how the Rails routing system works for your application (note: it only supports edge rails, not v1.1.2).
To test it out:
- Create a new rails application
$ rails routingtest - Install edge rails into vendor
$ cd routingtest
$ rake rails:freeze:edge - Install the routing navigator plugin
$ script/plugin source http://svn.techno-weenie.net/projects/plugins
$ script/plugin install routing_navigator - Install the plugin’s CSS and JS file
$ rake update_routing_navigator - Start your application
$ script/server - Browse to
/routing_navigator - Modify your routes, rinse and repeat
- You’ll also want to add the following to the
headof your layout if you want to inspect routes on any of your view pages:
<%= javascript_include_tag :defaults, 'routing_navigator' %>
<%= stylesheet_link_tag 'routing_navigator' %>
For the lazy and curious: the routes generated for a base Rails application:
| Route | Significant Keys | Requirements | Conditions |
|---|---|---|---|
| /:controller/service.wsdl/ | [:controller, :action] | {:action=>”wsdl”} | {} |
| /:controller/:action/:id/ | [:controller, :action, :id] | {} | {} |
…and the routes for a simple RESTful application, written using the simply_restful plugin:
| Route | Significant Keys | Requirements | Conditions |
|---|---|---|---|
| /:controller/service.wsdl/ | [:controller, :action] | {:action=>”wsdl”} | {} |
| /people.:format/ | [:format, :action, :controller] | {:action=>”create”, :controller=>”people”} | {:method=>:post} |
| /people/ | [:action, :controller] | {:action=>”create”, :controller=>”people”} | {:method=>:post} |
| /people.:format/ | [:format, :action, :controller] | {:action=>”index”, :controller=>”people”} | {:method=>:get} |
| /people/ | [:action, :controller] | {:action=>”index”, :controller=>”people”} | {:method=>:get} |
| /people/new.:format/ | [:format, :action, :controller] | {:action=>”new”, :controller=>”people”} | {:method=>:get} |
| /people/new/ | [:action, :controller] | {:action=>”new”, :controller=>”people”} | {:method=>:get} |
| /people/:id/ | [:id, :action, :controller] | {:action=>”destroy”, :controller=>”people”} | {:method=>:delete} |
| /people/:id/ | [:id, :action, :controller] | {:action=>”update”, :controller=>”people”} | {:method=>:put} |
| /people/:id.:format;edit/ | [:id, :format, :action, :controller] | {:action=>”edit”, :controller=>”people”} | {:method=>:get} |
| /people/:id;edit/ | [:id, :action, :controller] | {:action=>”edit”, :controller=>”people”} | {:method=>:get} |
| /people/:id.:format/ | [:id, :format, :action, :controller] | {:action=>”show”, :controller=>”people”} | {:method=>:get} |
| /people/:id/ | [:id, :action, :controller] | {:action=>”show”, :controller=>”people”} | {:method=>:get} |
| /:controller/:action/:id/ | [:controller, :action, :id] | {} | {} |
Related posts:
- Wearing the Other Shoe: Understanding How Your Clients Think Understand your clients' unique needs leads to stronger and more...
- Top Ruby Frameworks Rails and Merb Join Forces It's not every day that two essentially competing web development...
- Famous Rails Screencast Gets an Update When Ruby on Rails was first introduced, nothing helped put...
- PHP Framework Plans Socially Responsible Coding Contest The Symfony PHP framework is planning a 48-hour programming competition...
- Pretty URLs: Pretty Easy! The fourth edition of Build Your Own Database Driven Website...







Kinda OT, but regarding the new routing system in edge, do you know if it will support what isn’t supported at the moment ; .html endings.
I.e. all URLS end in .html /view/user/1.html, view/user.html etc ?
June 26th, 2006 at 7:44 am
Hey eadz! Yeah it sure does… notice the
/people.:format/route above? This can be called with:/people.html /people.xml /people.jsJune 26th, 2006 at 9:23 am
Nice one! Thanks Lucas.
June 26th, 2006 at 10:13 am