Module: PaperTrail::Background
- Defined in:
- lib/paper_trail/background.rb,
lib/paper_trail/background/sidekiq.rb,
lib/paper_trail/background/version.rb
Defined Under Namespace
Modules: Sidekiq
Constant Summary collapse
- VERSION =
"1.0.2"
Instance Method Summary collapse
-
#record_create ⇒ Object
private
paper_trail-association_tracking.
-
#record_destroy(recording_order) ⇒ Object
private
‘recording_order` is “after” or “before”.
-
#record_update(force:, in_after_callback:, is_touch:) ⇒ Object
private
paper_trail-association_tracking.
-
#record_update_columns(changes) ⇒ Object
private
paper_trail-association_tracking.
Instance Method Details
#record_create ⇒ 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.
paper_trail-association_tracking
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/paper_trail/background.rb', line 9 def record_create return unless enabled? event = PaperTrail::Events::Create.new(@record, true) # Merge data from `Event` with data from PT-AT. We no longer use # `data_for_create` but PT-AT still does. data = event.data.merge(data_for_create) trigger_write(@record, data, :create) end |
#record_destroy(recording_order) ⇒ 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.
‘recording_order` is “after” or “before”. See ModelConfig#on_destroy.
paper_trail-association_tracking
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/paper_trail/background.rb', line 26 def record_destroy(recording_order) return unless enabled? return if @record.new_record? in_after_callback = recording_order == "after" event = PaperTrail::Events::Destroy.new(@record, in_after_callback) # Merge data from `Event` with data from PT-AT. We no longer use # `data_for_destroy` but PT-AT still does. data = event.data.merge(data_for_destroy) trigger_write(@record, data, :destroy) end |
#record_update(force:, in_after_callback:, is_touch:) ⇒ 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.
paper_trail-association_tracking
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/paper_trail/background.rb', line 44 def record_update(force:, in_after_callback:, is_touch:) return unless enabled? event = PaperTrail::Events::Update.new(@record, in_after_callback, is_touch, nil) return unless force || event.changed_notably? # Merge data from `Event` with data from PT-AT. We no longer use # `data_for_update_columns` but PT-AT still does. data = event.data.merge(data_for_update_columns) trigger_write(@record, data, :update) end |
#record_update_columns(changes) ⇒ 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.
paper_trail-association_tracking
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/paper_trail/background.rb', line 61 def record_update_columns(changes) return unless enabled? event = Events::Update.new(@record, false, false, changes) return unless force || event.changed_notably? # Merge data from `Event` with data from PT-AT. We no longer use # `data_for_update_columns` but PT-AT still does. data = event.data.merge(data_for_update_columns) trigger_write(@record, data, :update) end |