Sha256: ab63630b0d20382586bdd2a39a4b70c68e22fe43ff3d5d219ce63475b0e54745

Contents?: true

Size: 420 Bytes

Versions: 4

Compression:

Stored size: 420 Bytes

Contents

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
        if TemporalTables.updated_by_proc && respond_to?(:updated_by)
          self.updated_by = TemporalTables.updated_by_proc.call(self)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
temporal_tables-0.8.1 lib/temporal_tables/whodunnit.rb
temporal_tables-0.8.0 lib/temporal_tables/whodunnit.rb
temporal_tables-0.7.1 lib/temporal_tables/whodunnit.rb
temporal_tables-0.7.0 lib/temporal_tables/whodunnit.rb