v1.0.0 - Show latest stable - 2 notes

No documentation

This module has no description. You can help the Ruby on Rails community by adding new notes.

Show files where this module is defined (1 file)
Register or log in to add new notes.
January 25, 2009
3 thanks

Routes = RouteSet.new

In config/routes.rb you can see this:

ActionController::Routing::Routes.draw do |map|
  #routes
end

If you want to look at the code in ActionController::Routing you won’t find the definition of Routes. That’s because it’s actually an instance of the class RouteSet, defined in action_controller/routing.rb

Routes = RouteSet.new
July 7, 2009
0 thanks

Pretty Printing Routes

if you’d like to check out your routes in the console, you can do something like:

routes = ActionController::Routing::Routes

# which will return a RouteSet puts routes.routes

which’ll give you a nice output like: GET /messages/ {:action=>“index”, :controller=>“messages”} GET /messages.:format/ {:action=>“index”, :controller=>“messages”} POST /messages/ {:action=>“create”, :controller=>“messages”} POST /messages.:format/ {:action=>“create”, :controller=>“messages”} GET /messages/new/ {:action=>“new”, :controller=>“messages”} GET /messages/new.:format/ {:action=>“new”, :controller=>“messages”} GET /messages/:id/edit/ {:action=>“edit”, :controller=>“messages”} GET /messages/:id/edit.:format/ {:action=>“edit”, :controller=>“messages”} GET /messages/:id/ {:action=>“show”, :controller=>“messages”} GET /messages/:id.:format/ {:action=>“show”, :controller=>“messages”} PUT /messages/:id/ {:action=>“update”, :controller=>“messages”} PUT /messages/:id.:format/ {:action=>“update”, :controller=>“messages”} DELETE /messages/:id/ {:action=>“destroy”, :controller=>“messages”} DELETE /messages/:id.:format/ {:action=>“destroy”, :controller=>“messages”}