Class: CableReady::Updatable::ModelUpdatableCallbacks
- Inherits:
-
Object
- Object
- CableReady::Updatable::ModelUpdatableCallbacks
- Defined in:
- app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb
Instance Method Summary collapse
- #after_commit(model) ⇒ Object
-
#initialize(operation, enabled_operations = %i[create update destroy], debounce: CableReady.config.updatable_debounce_time) ⇒ ModelUpdatableCallbacks
constructor
A new instance of ModelUpdatableCallbacks.
Constructor Details
#initialize(operation, enabled_operations = %i[create update destroy], debounce: CableReady.config.updatable_debounce_time) ⇒ ModelUpdatableCallbacks
Returns a new instance of ModelUpdatableCallbacks.
6 7 8 9 10 |
# File 'app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb', line 6 def initialize(operation, enabled_operations = %i[create update destroy], debounce: CableReady.config.updatable_debounce_time) @operation = operation @enabled_operations = enabled_operations @debounce = debounce end |
Instance Method Details
#after_commit(model) ⇒ Object
12 13 14 15 16 |
# File 'app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb', line 12 def after_commit(model) return unless @enabled_operations.include?(@operation) send("broadcast_#{@operation}", model) end |