Skip to content

Instantly share code, notes, and snippets.

@igaiga
Created May 14, 2022 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igaiga/e54a03817384c345c44702fe9d3d8284 to your computer and use it in GitHub Desktop.
Save igaiga/e54a03817384c345c44702fe9d3d8284 to your computer and use it in GitHub Desktop.
app_routes = Rails.application.routes.routes
ActionDispatch::Routing::RoutesInspector.new(app_routes).send(:collect_routes, app_routes)
#=>
[{:name=>"books",
:verb=>"GET",
:path=>"/books(.:format)",
:reqs=>"books#index"},
{:name=>"",
:verb=>"POST",
:path=>"/books(.:format)",
:reqs=>"books#create"},
{:name=>"new_book",
:verb=>"GET",
:path=>"/books/new(.:format)",
:reqs=>"books#new"},
{:name=>"edit_book",
:verb=>"GET",
:path=>"/books/:id/edit(.:format)",
:reqs=>"books#edit"},
{:name=>"book",
:verb=>"GET",
:path=>"/books/:id(.:format)",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment