Module: ActiveRecord::Materialized::DependencyTrackable Private

Extended by:
T::Sig
Defined in:
lib/activerecord/materialized/dependency_trackable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Installs ‘after_*_commit` callbacks on `depends_on` models so their writes schedule maintenance.

Constant Summary collapse

TRACKABLE_FLAG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:@ar_materialized_dependency_trackable

Class Method Summary collapse

Class Method Details

.publish(record, operation) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
# File 'lib/activerecord/materialized/dependency_trackable.rb', line 27

def publish(record, operation)
  DependencyRegistry.publish_write_change!(WriteChange.from_record(record, operation))
end

.reset!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'lib/activerecord/materialized/dependency_trackable.rb', line 32

def reset!
  nil
end

.subscribe(model_class) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
# File 'lib/activerecord/materialized/dependency_trackable.rb', line 18

def subscribe(model_class)
  return if model_class.instance_variable_get(TRACKABLE_FLAG)

  install_callbacks!(model_class)
  model_class.instance_variable_set(TRACKABLE_FLAG, true)
end