Class: ActionDispatch::DebugExceptions::DebugView

Inherits:
ActionView::Base
  • Object
show all
Defined in:
lib/action_dispatch/middleware/debug_exceptions.rb

Instance Method Summary collapse

Instance Method Details

#debug_hash(object) ⇒ Object



38
39
40
# File 'lib/action_dispatch/middleware/debug_exceptions.rb', line 38

def debug_hash(object)
  object.to_hash.sort_by { |k, _| k.to_s }.map { |k, v| "#{k}: #{v.inspect rescue $!.message}" }.join("\n")
end

#debug_headers(headers) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/action_dispatch/middleware/debug_exceptions.rb', line 30

def debug_headers(headers)
  if headers.present?
    headers.inspect.gsub(",", ",\n")
  else
    "None"
  end
end

#debug_params(params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/action_dispatch/middleware/debug_exceptions.rb', line 18

def debug_params(params)
  clean_params = params.clone
  clean_params.delete("action")
  clean_params.delete("controller")

  if clean_params.empty?
    "None"
  else
    PP.pp(clean_params, "".dup, 200)
  end
end

#renderObject



42
43
44
45
46
47
48
49
50
# File 'lib/action_dispatch/middleware/debug_exceptions.rb', line 42

def render(*)
  logger = ActionView::Base.logger

  if logger && logger.respond_to?(:silence)
    logger.silence { super }
  else
    super
  end
end