Sha256: 6223d9ddba7909456073807f8b9a59aca126003e0ce3dca62f980cee8f379a2c

Contents?: true

Size: 449 Bytes

Versions: 9

Compression:

Stored size: 449 Bytes

Contents

# frozen_string_literal: true

module TemporalTables
  module Whodunnit
    def self.included(base)
      base.class_eval do
        include InstanceMethods

        before_validation :set_updated_by
      end
    end

    module InstanceMethods
      def set_updated_by
        return unless TemporalTables.updated_by_proc && respond_to?(:updated_by)

        self.updated_by = TemporalTables.updated_by_proc.call(self)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
temporal_tables-3.0.2 lib/temporal_tables/whodunnit.rb
temporal_tables-3.0.1 lib/temporal_tables/whodunnit.rb
temporal_tables-3.0.0 lib/temporal_tables/whodunnit.rb
temporal_tables-3.0.0.pre.rc.1 lib/temporal_tables/whodunnit.rb
temporal_tables-2.0.0 lib/temporal_tables/whodunnit.rb
temporal_tables-1.1.0 lib/temporal_tables/whodunnit.rb
temporal_tables-1.0.3 lib/temporal_tables/whodunnit.rb
temporal_tables-1.0.2 lib/temporal_tables/whodunnit.rb
temporal_tables-1.0.1 lib/temporal_tables/whodunnit.rb