Posted about 5 years ago. Visible to the public. Deprecated.
Speed up better_errors
Current versions of better_errors already do this automatically.
If you use the Better Errors gem Archive , you will sometimes notice that it can be very slow. This is because it sometimes renders a huge amount of data that will actually be hard to render for your browser.
You can significantly improve performance by adding this to config/initializers/better_errors
:
Copyif defined?(BetterErrors) && Rails.env.development? module BetterErrorsHugeInspectWarning def inspect_value(obj) inspected = obj.inspect if inspected.size > 20_000 inspected = "Object was too large to inspect (#{inspected.size} bytes). " end CGI.escapeHTML(inspected) rescue NoMethodError "<span class='unsupported'>(object doesn't support inspect)</span>" rescue Exception "<span class='unsupported'>(exception was raised in inspect)</span>" end end BetterErrors.ignored_instance_variables += [ :@_request, :@_assigns, :@_controller, :@view_renderer ] BetterErrors::ErrorPage.prepend(BetterErrorsHugeInspectWarning) end
(credits to GitHub user bquorning)
Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).