Class: Rails::InfoController

Inherits:
ApplicationController show all
Defined in:
lib/rails/info_controller.rb

Overview

:nodoc:

Constant Summary collapse

RFC2396_PARSER =
defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new

Instance Method Summary collapse

Instance Method Details

#indexObject



14
15
16
# File 'lib/rails/info_controller.rb', line 14

def index
  redirect_to action: :routes
end

#propertiesObject



18
19
20
21
# File 'lib/rails/info_controller.rb', line 18

def properties
  @info = Rails::Info.to_html
  @page_title = "Properties"
end

#routesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rails/info_controller.rb', line 23

def routes
  if query = params[:query]
    query = RFC2396_PARSER.escape query

    render json: {
      exact: matching_routes(query: query, exact_match: true),
      fuzzy: matching_routes(query: query, exact_match: false)
    }
  else
    @routes_inspector = ActionDispatch::Routing::RoutesInspector.new(_routes.routes)
    @page_title = "Routes"
  end
end