Module: Fixtury::MutationObserver::ActiveRecordHooks

Defined in:
lib/fixtury/mutation_observer.rb

Overview

Hooks into the lifecycle of an ActiveRecord::Base object to report changes to the MutationObserver. This is automatically prepended to ActiveRecord::Base when Rails is present.

Instance Method Summary collapse

Instance Method Details

#_create_record(*args) ⇒ Object



15
16
17
18
19
# File 'lib/fixtury/mutation_observer.rb', line 15

def _create_record(*args)
  result = super
  MutationObserver.on_record_create(self)
  result
end

#_update_record(**args) ⇒ Object



21
22
23
24
# File 'lib/fixtury/mutation_observer.rb', line 21

def _update_record(**args)
  MutationObserver.on_record_update(self, changes)
  super
end

#update_columns(changes) ⇒ Object



26
27
28
29
# File 'lib/fixtury/mutation_observer.rb', line 26

def update_columns(changes)
  MutationObserver.on_record_update(self, changes)
  super
end