aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
author@schneems and @mattt <m@mattt.me>2012-07-01 20:00:10 -0700
committerschneems <richard.schneeman@gmail.com>2012-07-07 15:39:49 -0500
commitef91cddb48d1fa8d1a34e8e5ac68fe9eb56c160f (patch)
treeb78de2d49cf9c27cf0f56e50f54f8344d4d62380 /railties
parentfa714ec7dffd12b8508c756e6526eff5ae8e4202 (diff)
downloadrails-ef91cddb48d1fa8d1a34e8e5ac68fe9eb56c160f.tar.gz
rails-ef91cddb48d1fa8d1a34e8e5ac68fe9eb56c160f.tar.bz2
rails-ef91cddb48d1fa8d1a34e8e5ac68fe9eb56c160f.zip
move route_inspector to actionpack
this is so we can show route output in the development when we get a routing error. Railties can use features of ActionDispatch, but ActionDispatch should not depend on Railties.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/application.rb4
-rw-r--r--railties/lib/rails/info_controller.rb3
-rw-r--r--railties/lib/rails/tasks/routes.rake4
3 files changed, 6 insertions, 5 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index d5ec2cbfd9..3afbf0a03e 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -267,6 +267,7 @@ module Rails
def default_middleware_stack #:nodoc:
ActionDispatch::MiddlewareStack.new.tap do |middleware|
+ app = self
if rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache
require "action_dispatch/http/rack_cache"
middleware.use ::Rack::Cache, rack_cache
@@ -290,11 +291,10 @@ module Rails
middleware.use ::ActionDispatch::RequestId
middleware.use ::Rails::Rack::Logger, config.log_tags # must come after Rack::MethodOverride to properly log overridden methods
middleware.use ::ActionDispatch::ShowExceptions, config.exceptions_app || ActionDispatch::PublicExceptions.new(Rails.public_path)
- middleware.use ::ActionDispatch::DebugExceptions
+ middleware.use ::ActionDispatch::DebugExceptions, app
middleware.use ::ActionDispatch::RemoteIp, config.action_dispatch.ip_spoofing_check, config.action_dispatch.trusted_proxies
unless config.cache_classes
- app = self
middleware.use ::ActionDispatch::Reloader, lambda { app.reload_dependencies? }
end
diff --git a/railties/lib/rails/info_controller.rb b/railties/lib/rails/info_controller.rb
index bacdcbf3aa..83ab8c7e9d 100644
--- a/railties/lib/rails/info_controller.rb
+++ b/railties/lib/rails/info_controller.rb
@@ -1,4 +1,4 @@
-require 'rails/application/routes_inspector'
+require 'action_dispatch/routing/inspector'
class Rails::InfoController < ActionController::Base
self.view_paths = File.join(File.dirname(__FILE__), 'templates')
@@ -16,6 +16,7 @@ class Rails::InfoController < ActionController::Base
def routes
inspector = Rails::Application::RoutesInspector.new
+ inspector = ActionDispatch::Routing::RouteInspector.new
@info = inspector.format(_routes.routes).join("\n")
end
diff --git a/railties/lib/rails/tasks/routes.rake b/railties/lib/rails/tasks/routes.rake
index 4ade825616..afc4e147e1 100644
--- a/railties/lib/rails/tasks/routes.rake
+++ b/railties/lib/rails/tasks/routes.rake
@@ -1,7 +1,7 @@
desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
task :routes => :environment do
all_routes = Rails.application.routes.routes
- require 'rails/application/routes_inspector'
- inspector = Rails::Application::RoutesInspector.new
+ require 'action_dispatch/routing/inspector'
+ inspector = ActionDispatch::Routing::RouteInspector.new
puts inspector.format(all_routes, ENV['CONTROLLER']).join "\n"
end