Module: Rollgeist::Patches::Persistence

Defined in:
lib/rollgeist/patches/persistence.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rollgeist/patches/persistence.rb', line 12

def destroy(...)
  return super unless defined?(@__rollgeist_mark)

  Rollgeist::Notifier.notify(self, :resave)
  mark = instance_variable_get(MARK_IVAR)
  reported = instance_variable_get(REPORTED_IVAR) if instance_variable_defined?(REPORTED_IVAR)
  Rollgeist.clear_mark!(self)
  result = super
  restore_mark(mark, reported) unless result
  result
rescue Exception # rubocop:disable Lint/RescueException
  restore_mark(mark, reported) if mark && !frozen?
  raise
end

#reloadObject



6
7
8
9
10
# File 'lib/rollgeist/patches/persistence.rb', line 6

def reload(...)
  result = super
  Rollgeist.clear_mark!(self)
  result
end