Module: ActiveRecordCompose::Callbacks
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations::Callbacks
- Included in:
- Persistence
- Defined in:
- lib/active_record_compose/callbacks.rb
Overview
Provides hooks into the life cycle of an ActiveRecordCompose model, allowing you to insert custom logic before or after changes to the object's state.
The callback flow generally follows the same structure as Active Record:
before_validationafter_validationbefore_savebefore_create(orbefore_updatefor update operations)after_create(orafter_updatefor update operations)after_saveafter_commit(orafter_rollbackwhen the transaction is rolled back)
Class Method Summary collapse
-
.after_create(*args, &block) ⇒ void
Registers a callback to be called after a model is created.
-
.after_save(*args, &block) ⇒ void
Registers a callback to be called after a model is saved.
-
.after_update(*args, &block) ⇒ void
Registers a callback to be called after a update is updated.
-
.around_create(*args, &block) ⇒ void
Registers a callback to be called around the creation of a model.
-
.around_save(*args, &block) ⇒ void
Registers a callback to be called around the save of a model.
-
.around_update(*args, &block) ⇒ void
Registers a callback to be called around the update of a model.
-
.before_create(*args, &block) ⇒ void
Registers a callback to be called before a model is created.
-
.before_save(*args, &block) ⇒ void
Registers a callback to be called before a model is saved.
-
.before_update(*args, &block) ⇒ void
Registers a callback to be called before a model is updated.
Class Method Details
.after_create(*args, &block) ⇒ void
Registers a callback to be called after a model is created.
42 |
# File 'lib/active_record_compose/callbacks.rb', line 42 define_model_callbacks :create |
.after_save(*args, &block) ⇒ void
Registers a callback to be called after a model is saved.
31 |
# File 'lib/active_record_compose/callbacks.rb', line 31 define_model_callbacks :save |
.after_update(*args, &block) ⇒ void
Registers a callback to be called after a update is updated.
52 |
# File 'lib/active_record_compose/callbacks.rb', line 52 define_model_callbacks :update |
.around_create(*args, &block) ⇒ void
Registers a callback to be called around the creation of a model.
|
|
# File 'lib/active_record_compose/callbacks.rb', line 36
|
.around_save(*args, &block) ⇒ void
Registers a callback to be called around the save of a model.
|
|
# File 'lib/active_record_compose/callbacks.rb', line 25
|
.around_update(*args, &block) ⇒ void
Registers a callback to be called around the update of a model.
|
|
# File 'lib/active_record_compose/callbacks.rb', line 47
|
.before_create(*args, &block) ⇒ void
Registers a callback to be called before a model is created.
|
|
# File 'lib/active_record_compose/callbacks.rb', line 33
|
.before_save(*args, &block) ⇒ void
Registers a callback to be called before a model is saved.
|
|
# File 'lib/active_record_compose/callbacks.rb', line 22
|
.before_update(*args, &block) ⇒ void
Registers a callback to be called before a model is updated.
|
|
# File 'lib/active_record_compose/callbacks.rb', line 44
|