Module: ActiveRecordCallbacksDebug::CallTemplateExtension

Included in:
ActiveSupport::Callbacks::CallTemplate
Defined in:
lib/active_record_callbacks_debug.rb

Instance Method Summary collapse

Instance Method Details

#expand(target, value, block) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/active_record_callbacks_debug.rb', line 62

def expand(target, value, block)
  if ::ActiveRecordCallbacksDebug.configuration.active
    result = nil
    params = {
      target: target,
      value: value,
      block: block,
      over_target: @override_target,
      over_method: @method_name,
      over_block: @override_block
    }
    bench = Benchmark.measure { result = super(target, value, block) }
    ::ActiveRecordCallbacksDebug.log(params, bench)
    result
  else
    super(target, value, block)
  end
end