From 3abb76824b87ad7142e43d764ef09bac73c2066d Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 6 Jan 2013 11:19:24 -0200 Subject: Move table routes formatter class to the inspector and rename it It feels more consistent to have this class called "HtmlTableFormatter", and to have it here with the routes inspector and console formatter, since it's used for both routing error exceptions and the rails info page. --- .../lib/action_dispatch/middleware/debug_exceptions.rb | 18 ------------------ .../middleware/templates/rescues/routing_error.erb | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) (limited to 'actionpack/lib/action_dispatch/middleware') diff --git a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb index 5c50f9ec6a..6bc5876b6c 100644 --- a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb @@ -89,23 +89,5 @@ module ActionDispatch ActionDispatch::Routing::RoutesInspector.new(@routes_app.routes.routes) end end - - class TableRoutesFormatter - def initialize(view) - @view = view - @buffer = [] - end - - def section(type, title, routes) - @buffer << %(#{title}) - @buffer << @view.render(partial: "routes/route", collection: routes) - end - - def result - @view.raw @view.render(layout: "routes/route_wrapper") { - @view.raw @buffer.join("\n") - } - end - end end end diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb index 3e55b23025..61690d3e50 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.erb @@ -25,6 +25,6 @@ Routes match in priority from top to bottom

- <%= @routes_inspector.format(ActionDispatch::DebugExceptions::TableRoutesFormatter.new(self)) %> + <%= @routes_inspector.format(ActionDispatch::Routing::HtmlTableFormatter.new(self)) %> <% end %> -- cgit v1.2.3