Module: ActiveRecord::Materialized::DependencyTrackable Private
- 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
-
.publish(record, operation) ⇒ Object
private
Invoked from the model commit callbacks;
recordis the committed instance. - .reset! ⇒ Object private
- .subscribe(model_class) ⇒ Object private
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.
Invoked from the model commit callbacks; record is the committed instance.
Publishes as the :callbacks source so views fed by another change source
are not maintained twice.
22 23 24 |
# File 'lib/activerecord/materialized/dependency_trackable.rb', line 22 def publish(record, operation) DependencyRegistry.publish_write_change!(WriteChange.from_record(record, operation), source: :callbacks) 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.
26 27 28 |
# File 'lib/activerecord/materialized/dependency_trackable.rb', line 26 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.
12 13 14 15 16 17 |
# File 'lib/activerecord/materialized/dependency_trackable.rb', line 12 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 |