Sha256: 7bd3d8e4579dbc4ebe8f20590a288a95777f2c815958f688fa411c18e89562ad

Contents?: true

Size: 805 Bytes

Versions: 16

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

require "paper_trail/events/base"

module PaperTrail
  module Events
    # See docs in `Base`.
    #
    # @api private
    class Create < Base
      # Return attributes of nascent `Version` record.
      #
      # @api private
      def data
        data = {
          item: @record,
          event: @record.paper_trail_event || "create",
          whodunnit: PaperTrail.request.whodunnit
        }
        if @record.respond_to?(:updated_at)
          data[:created_at] = @record.updated_at
        end
        if record_object_changes? && changed_notably?
          changes = notable_changes
          data[:object_changes] = prepare_object_changes(changes)
        end
        merge_item_subtype_into(data)
        merge_metadata_into(data)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
paper_trail-16.0.0 lib/paper_trail/events/create.rb
paper_trail-15.2.0 lib/paper_trail/events/create.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/paper_trail-12.3.0/lib/paper_trail/events/create.rb
paper_trail-15.1.0 lib/paper_trail/events/create.rb
paper_trail-15.0.0 lib/paper_trail/events/create.rb
paper_trail-14.0.0 lib/paper_trail/events/create.rb
paper_trail-13.0.0 lib/paper_trail/events/create.rb
paper_trail-12.3.0 lib/paper_trail/events/create.rb
paper_trail-12.2.0 lib/paper_trail/events/create.rb
paper_trail-12.1.0 lib/paper_trail/events/create.rb
paper_trail-12.0.0 lib/paper_trail/events/create.rb
paper_trail-11.1.0 lib/paper_trail/events/create.rb
paper_trail-11.0.0 lib/paper_trail/events/create.rb
paper_trail-10.3.1 lib/paper_trail/events/create.rb
paper_trail-10.3.0 lib/paper_trail/events/create.rb
paper_trail-10.2.1 lib/paper_trail/events/create.rb