From 4a3cc59df9ff65efc8e529bd9d21dc379078f257 Mon Sep 17 00:00:00 2001 From: Jamie Wilkinson Date: Wed, 6 Apr 2011 17:45:45 -0700 Subject: [PATCH] Fix crazy slow dev-mode exception pages using targeted .inspect monkeypatches --- config/environments/development.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config/environments/development.rb b/config/environments/development.rb index f9ed1eb16..0051d171d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -22,4 +22,18 @@ Diaspora::Application.configure do config.action_mailer.raise_delivery_errors = false config.active_support.deprecation = :log #config.threadsafe! + + # Monkeypatch around the nasty "2.5MB exception page" issue, caused by very large environment vars + # This snippet via: http://stackoverflow.com/questions/3114993/exception-pages-in-development-mode-take-upwards-of-15-30-seconds-to-render-why + # Relevant Rails ticket: https://rails.lighthouseapp.com/projects/8994/tickets/5027-_request_and_responseerb-and-diagnosticserb-take-an-increasingly-long-time-to-render-in-development-with-multiple-show-tables-calls + config.after_initialize do + module SmallInspect + def inspect + "<#{self.class.name} - tooooo long>" + end + end + [ActionController::Base, ActionDispatch::RemoteIp::RemoteIpGetter, OmniAuth::Strategy, Warden::Proxy].each do |klazz| + klazz.send(:include, SmallInspect) + end + end end