Sha256: d754ca96979e097e6acccf6da030abbdfbe7191fb1fdfaa461a43c43d39090ca
Contents?: true
Size: 842 Bytes
Versions: 16
Compression:
Stored size: 842 Bytes
Contents
# frozen_string_literal: true module Decidim module Plans # The Tracer class allows performing PaperTrail requests where all records # saved during the yield will be stored against the same transaction ID. # This allows saving the main record and its associated records so that the # same changeset can be easily identified afterwards. class Tracer def trace!(author) return unless block_given? ::PaperTrail.request(whodunnit: gid(author)) do yield end end private # Calculates the GlobalID of the version author. If the object does not # respond to `to_gid`, then it returns the object itself. def gid(author) return if author.blank? return author.to_gid if author.respond_to?(:to_gid) author end end end end
Version data entries
16 entries across 16 versions & 1 rubygems