Module: ActivePropagation::ClassExtensions
- Defined in:
- lib/active_propagation/class_extensions.rb
Instance Attribute Summary collapse
-
#_active_propagation_changes ⇒ Object
Returns the value of attribute _active_propagation_changes.
Instance Method Summary collapse
Instance Attribute Details
#_active_propagation_changes ⇒ Object
Returns the value of attribute _active_propagation_changes.
14 15 16 |
# File 'lib/active_propagation/class_extensions.rb', line 14 def _active_propagation_changes @_active_propagation_changes end |
Instance Method Details
#propagates_changes_to(association, only: [], async: false, nested_async: false, on: [:update, :destroy]) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/active_propagation/class_extensions.rb', line 2 def propagates_changes_to(association, only: [], async: false, nested_async: false, on: [:update, :destroy]) props = if class_variable_defined?(:@@propagations) self.class_variable_get(:@@propagations) || {} else {} end self.class_variable_set(:@@propagations, props) before_save(:_save_active_propagation_changes, on: on) unless _commit_callbacks.map(&:filter).include?(:_save_active_propagation_changes) after_commit(:_run_active_propagation, on: on) unless _commit_callbacks.map(&:filter).include?(:_run_active_propagation) self.class_variable_get(:@@propagations)[association] = {only: only, async: async, nested_async: nested_async} end |