instance method debug

Ruby on Rails 8.1.2

Since v8.1.2

Signature

debug(name_or_object, payload = nil, caller_depth: 1, **kwargs)

Report an event only when in debug mode. For example:

Rails.event.debug("sql.query", { sql: "SELECT * FROM users" })

Arguments

  • :payload - The event payload when using string/symbol event names.

  • :caller_depth - The stack depth to use for source location (default: 1).

  • :kwargs - Additional payload data when using string/symbol event names.

Parameters

name_or_object req
payload opt = nil
caller_depth key = 1
kwargs keyrest
Source
# File activesupport/lib/active_support/event_reporter.rb, line 435
    def debug(name_or_object, payload = nil, caller_depth: 1, **kwargs)
      if debug_mode?
        if block_given?
          notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs.merge(yield))
        else
          notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs)
        end
      end
    end

Defined in activesupport/lib/active_support/event_reporter.rb line 435 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::EventReporter

Type at least 2 characters to search.

↑↓ navigate · open · esc close