Class: PaperTrail::Events::Update Private
- Defined in:
- lib/mongo_trails/events/update.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
See docs in Base.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#data ⇒ Object
private
Return attributes of nascent
Versionrecord. -
#initialize(record, in_after_callback, is_touch, force_changes) ⇒ Update
constructor
private
-
is_touch - [boolean] - Used in the two situations that are touch-like: -
after_touchwe call ‘RecordTrail#record_update` - force_changes - [Hash] - Only used by `RecordTrail#update_columns`, because there dirty-tracking is off, so it has to track its own changes.
-
Methods inherited from Base
Constructor Details
#initialize(record, in_after_callback, is_touch, force_changes) ⇒ Update
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.
-
is_touch - [boolean] - Used in the two situations that are touch-like:
-
after_touchwe call ‘RecordTrail#record_update`
-
-
force_changes - [Hash] - Only used by ‘RecordTrail#update_columns`, because there dirty-tracking is off, so it has to track its own changes.
17 18 19 20 21 |
# File 'lib/mongo_trails/events/update.rb', line 17 def initialize(record, in_after_callback, is_touch, force_changes) super(record, in_after_callback) @is_touch = is_touch @force_changes = force_changes end |
Instance Method Details
#data ⇒ 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.
Return attributes of nascent Version record.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mongo_trails/events/update.rb', line 26 def data data = { item: @record, event: @record.paper_trail_event || "update", whodunnit: PaperTrail.request.whodunnit } if @record.respond_to?(:updated_at) data[:created_at] = @record.updated_at end if record_object? data[:object] = recordable_object(@is_touch) end if record_object_changes? changes = @force_changes.nil? ? notable_changes : @force_changes data[:object_changes] = prepare_object_changes(changes) end merge_item_subtype_into(data) (data) end |