0

Is there a way to make a table with a listing of all the controllers and actions similar to what you see in the rake routes?

Thanks!

Dave
  • 783
  • 3
  • 15
  • 25

1 Answers1

1

there'a already a topic: How to programmatically list all controllers in Rails

one approach:

routes= Rails.application.routes.routes.map do |route|
  {alias: route.name, path: route.path.spec.to_s, controller: route.defaults[:controller], action: route.defaults[:action]}
end
Community
  • 1
  • 1
Said Kaldybaev
  • 9,380
  • 8
  • 36
  • 53