Sha256: 039a0103f0b731b5d1b176b3d95ab5c7f65ed098696da54529ba0d2f3c273604

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

module PrettyRoutes
  #
  # Route controller. It displays all routes in your application
  #
  class RoutesController < PrettyRoutes::ApplicationController
    include PrettyRoutes::RoutesHelper

    layout 'pretty_routes/application'

    before_filter :require_local!

    def index
      @routes = PrettyRoutes.format_routes
    end

    private

    def require_local!
      return if local_request?
      render text: '<p>For security purposes, this information is only' \
                   'available to local requests.</p>',
             status: :forbidden
    end

    def local_request?
      Rails.application.config.consider_all_requests_local || request.local?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pretty_routes-0.2.0 app/controllers/pretty_routes/routes_controller.rb
pretty_routes-0.1.1 app/controllers/pretty_routes/routes_controller.rb
pretty_routes-0.1.0 app/controllers/pretty_routes/routes_controller.rb