- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (0)
- 2.1.0 (38)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
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
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”}