Module: RouteDataService

Defined in:
app/services/route_data_service.rb

Overview

Takes the routes defined in the application and converts to a list of hashes,

where each Hash has the Route's:
  - path
  - action
  - controller

Class Method Summary collapse

Class Method Details

.get_routes_dataObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/route_data_service.rb', line 7

def self.get_routes_data
  Rails.application.routes.routes.select do |route|
    !route.defaults[:internal]
  end.map do |route|
    {
      path: route.path.spec.to_s,
      action: route.defaults[:action],
      controller: route.defaults[:controller]
    }
  end.select do |route_data|
    route_data.values.map(&:present?).all?
  end
end