Module: WellFormed::PaperTrail

Defined in:
lib/well_formed/paper_trail.rb,
lib/well_formed/paper_trail/version.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.whodunnitObject

Global default whodunnit proc, used when no per-form paper_trail_whodunnit is set. The proc receives the form’s user as its argument.

WellFormed::PaperTrail.whodunnit = ->(user) { user&.email }


13
14
15
# File 'lib/well_formed/paper_trail.rb', line 13

def whodunnit
  @whodunnit
end

Class Method Details

.included(base) ⇒ Object



16
17
18
19
20
# File 'lib/well_formed/paper_trail.rb', line 16

def self.included(base)
  base.extend(ClassMethods)
  base.set_callback(:save, :around, :_with_paper_trail) if base.respond_to?(:_save_callbacks)
  base.set_callback(:perform, :around, :_with_paper_trail) if base.respond_to?(:_perform_callbacks)
end