lib/audited/audit.rb in velocity_audited-5.1.4 vs lib/audited/audit.rb in velocity_audited-5.1.5
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
require "set"
-module Audited
+module VelocityAudited
# Audit saves the changes to ActiveRecord models. It has the following attributes:
#
# * <tt>auditable</tt>: the ActiveRecord model that was changed
# * <tt>user</tt>: the user that performed the change; a string or an ActiveRecord model
# * <tt>action</tt>: one of create, update, or delete
@@ -32,11 +32,11 @@
obj
end
end
def text_column?
- Audited.audit_class.columns_hash["audited_changes"].type.to_s == "text"
+ VelocityAudited.audit_class.columns_hash["audited_changes"].type.to_s == "text"
end
end
end
class Audit < ::ActiveRecord::Base
@@ -132,15 +132,15 @@
# All audits made during the block called will be recorded as made
# by +user+. This method is hopefully threadsafe, making it ideal
# for background operations that require audit information.
def self.as_user(user)
- last_audited_user = ::Audited.store[:audited_user]
- ::Audited.store[:audited_user] = user
+ last_audited_user = ::VelocityAudited.store[:audited_user]
+ ::VelocityAudited.store[:audited_user] = user
yield
ensure
- ::Audited.store[:audited_user] = last_audited_user
+ ::VelocityAudited.store[:audited_user] = last_audited_user
end
# @private
def self.reconstruct_attributes(audits)
audits.each_with_object({}) do |audit, all|
@@ -179,20 +179,20 @@
self.version = max + 1
end
end
def set_audit_user
- self.user ||= ::Audited.store[:audited_user] # from .as_user
- self.user ||= ::Audited.store[:current_user].try!(:call) # from Sweeper
+ self.user ||= ::VelocityAudited.store[:audited_user] # from .as_user
+ self.user ||= ::VelocityAudited.store[:current_user].try!(:call) # from Sweeper
nil # prevent stopping callback chains
end
def set_request_uuid
- self.request_uuid ||= ::Audited.store[:current_request_uuid]
+ self.request_uuid ||= ::VelocityAudited.store[:current_request_uuid]
self.request_uuid ||= SecureRandom.uuid
end
def set_remote_address
- self.remote_address ||= ::Audited.store[:current_remote_address]
+ self.remote_address ||= ::VelocityAudited.store[:current_remote_address]
end
end
end