Sha256: d4a0c391b67c98c1417afbdcc7b5a6b518fdb274ba94d94885414cb3c9a7449d
Contents?: true
Size: 944 Bytes
Versions: 3
Compression:
Stored size: 944 Bytes
Contents
# frozen_string_literal: true require "paper_trail/events/base" module PaperTrail module Events # See docs in `Base`. # # @api private class Destroy < Base # Return attributes of nascent `Version` record. # # @api private def data data = { item_id: @record.id, item_type: @record.class.base_class.name, event: @record.paper_trail_event || "destroy", whodunnit: PaperTrail.request.whodunnit } if record_object? data[:object] = recordable_object(false) end if record_object_changes? # Rails' implementation returns nothing on destroy :/ changes = @record.attributes.map { |attr, value| [attr, [value, nil]] }.to_h data[:object_changes] = prepare_object_changes(changes) end merge_item_subtype_into(data) merge_metadata_into(data) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
paper_trail-10.1.0 | lib/paper_trail/events/destroy.rb |
paper_trail-10.0.1 | lib/paper_trail/events/destroy.rb |
paper_trail-10.0.0 | lib/paper_trail/events/destroy.rb |