diff options
Diffstat (limited to 'railties/lib/rails/info_controller.rb')
-rw-r--r-- | railties/lib/rails/info_controller.rb | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/railties/lib/rails/info_controller.rb b/railties/lib/rails/info_controller.rb index fe1e25d88c..49e5431a16 100644 --- a/railties/lib/rails/info_controller.rb +++ b/railties/lib/rails/info_controller.rb @@ -1,33 +1,23 @@ +require 'rails/application_controller' require 'action_dispatch/routing/inspector' -class Rails::InfoController < ActionController::Base - self.view_paths = File.expand_path('../templates', __FILE__) - layout 'application' +class Rails::InfoController < Rails::ApplicationController # :nodoc: + prepend_view_path ActionDispatch::DebugExceptions::RESCUES_TEMPLATE_PATH + layout -> { request.xhr? ? false : 'application' } - before_filter :require_local! + before_action :require_local! def index - redirect_to '/rails/info/routes' + redirect_to action: :routes end def properties @info = Rails::Info.to_html + @page_title = 'Properties' end def routes - inspector = ActionDispatch::Routing::RoutesInspector.new - @info = inspector.format(_routes.routes).join("\n") - end - - protected - - def require_local! - unless local_request? - render text: '<p>For security purposes, this information is only available to local requests.</p>', status: :forbidden - end - end - - def local_request? - Rails.application.config.consider_all_requests_local || request.local? + @routes_inspector = ActionDispatch::Routing::RoutesInspector.new(_routes.routes) + @page_title = 'Routes' end end |