Sha256: 53353d028c29f703165fe6874a7b5b3713f5069e5361c7dffe12d10cddbe9ffc

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require "active_record"

module Audited
  class << self
    attr_accessor \
      :auditing_enabled,
      :current_user_method,
      :ignored_attributes,
      :max_audits,
      :store_synthesized_enums
    attr_writer :audit_class

    def audit_class
      @audit_class ||= "Audited::Audit"
    end

    def audit_model
      audit_class.constantize
    end

    def store
      current_store_value = Thread.current.thread_variable_get(:audited_store)

      if current_store_value.nil?
        Thread.current.thread_variable_set(:audited_store, {})
      else
        current_store_value
      end
    end

    def config
      yield(self)
    end
  end

  @ignored_attributes = %w[lock_version created_at updated_at created_on updated_on]

  @current_user_method = :current_user
  @auditing_enabled = true
  @store_synthesized_enums = false
end

require "audited/auditor"

ActiveSupport.on_load :active_record do
  require "audited/audit"
  include Audited::Auditor
end

require "audited/sweeper"
require "audited/railtie"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
audited-5.1.0 lib/audited.rb