From 71d67fc6bd504956bce66e274e6228dd00a814c1 Mon Sep 17 00:00:00 2001
From: Joshua Peek
Date: Mon, 18 Jan 2010 21:22:09 -0600
Subject: [PATCH] Prettier hash dump
---
.../templates/rescues/_request_and_response.erb | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
index 7465f2c69b..839df50999 100644
--- a/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
+++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
@@ -11,16 +11,20 @@
clean_params.delete("controller")
request_dump = clean_params.empty? ? 'None' : clean_params.inspect.gsub(',', ",\n")
+
+ def debug_hash(hash)
+ hash.sort_by { |k, v| k.to_s }.map { |k, v| "#{k}: #{v.inspect}" }.join("\n")
+ end
%>
Request
Parameters:
<%=h request_dump %>
Show session dump
-<%= debug(@request.session) %>
+<%= debug_hash @request.session %>
-Show Rack ENV
-<%= debug(@request.env) %>
+Show env dump
+<%= debug_hash @request.env %>
Response