effective_logging 3.0.2 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc9fced444e21c7fe1cdfc6eefbb7a4a1c5aefde46e660c80ea8e556e4811a53
|
4
|
+
data.tar.gz: '02657769444b4e41d0fd0fa0ecd1d083aa5e60b7ba49df2f64be18d70e434404'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01efee520769124bc69f458c9db6301a3c9413ea43da4fae9b74cebf5b387a951828a058256c26db99926eb8a89851cfda74f85d879c90809586e3284c1503de
|
7
|
+
data.tar.gz: ed09985141339c9fe27f9f377bf84ed8e4c0e902609f0eddb493d235f9fc0ee78812cb7afd97592a4ff3c83fe3a0c0e281b9feb706f136360d253f2dd57c7093
|
data/app/models/effective/log.rb
CHANGED
@@ -8,13 +8,12 @@ module Effective
|
|
8
8
|
attr_accessor :prev_log
|
9
9
|
|
10
10
|
# Self-Referencing relationship
|
11
|
-
belongs_to :parent, class_name: 'Effective::Log', counter_cache: true
|
11
|
+
belongs_to :parent, class_name: 'Effective::Log', counter_cache: true, optional: true
|
12
12
|
has_many :logs, class_name: 'Effective::Log', foreign_key: :parent_id
|
13
13
|
|
14
|
-
belongs_to :user
|
15
|
-
|
16
|
-
belongs_to :
|
17
|
-
belongs_to :associated, polymorphic: true
|
14
|
+
belongs_to :user, optional: true
|
15
|
+
belongs_to :changes_to, polymorphic: true, optional: true # This is the log_changes to: option
|
16
|
+
belongs_to :associated, polymorphic: true, optional: true
|
18
17
|
|
19
18
|
serialize :details, Hash
|
20
19
|
|
@@ -44,6 +43,10 @@ module Effective
|
|
44
43
|
"Log #{id}"
|
45
44
|
end
|
46
45
|
|
46
|
+
def associated_to_s=(value)
|
47
|
+
super(value.to_s[0...255].presence) # Take only first 255 characters
|
48
|
+
end
|
49
|
+
|
47
50
|
def log(message, status = EffectiveLogging.statuses.first, options = {})
|
48
51
|
EffectiveLogger.log(message, status, (options || {}).merge(parent: self))
|
49
52
|
end
|
@@ -5,16 +5,17 @@ module EffectiveLogging
|
|
5
5
|
BLANK = "''"
|
6
6
|
BLACKLIST = [:updated_at, :created_at, :encrypted_password, :status_steps] # Don't log changes or attributes
|
7
7
|
|
8
|
-
|
8
|
+
# to, prefix, only, except
|
9
|
+
def initialize(object, args = {})
|
9
10
|
@object = object
|
10
11
|
@resource = Effective::Resource.new(object)
|
11
12
|
|
12
13
|
# Validate changes_to value
|
13
|
-
if to.present? && !@resource.belong_tos.map(&:name).include?(to)
|
14
|
-
raise ArgumentError.new("unable to find existing belongs_to relationship matching #{to}. Expected a symbol matching a belongs_to.")
|
14
|
+
if args[:to].present? && !@resource.belong_tos.map(&:name).include?(args[:to])
|
15
|
+
raise ArgumentError.new("unable to find existing belongs_to relationship matching #{args[:to]}. Expected a symbol matching a belongs_to.")
|
15
16
|
end
|
16
17
|
|
17
|
-
@options = { to: to, prefix: prefix, only: only, except: Array(except) + BLACKLIST }.compact
|
18
|
+
@options = { to: args[:to], prefix: args[:prefix], only: args[:only], except: Array(args[:except]) + BLACKLIST }.compact
|
18
19
|
end
|
19
20
|
|
20
21
|
# Effective::Log.where(message: 'Deleted').where('details ILIKE ?', '%lab_test_id: 263%')
|
@@ -22,7 +22,7 @@ module EffectiveLogging
|
|
22
22
|
# Include acts_as_loggable concern and allow any ActiveRecord object to call it with log_changes()
|
23
23
|
initializer 'effective_logging.active_record' do |app|
|
24
24
|
ActiveSupport.on_load :active_record do
|
25
|
-
ActiveRecord::Base.extend(ActsAsLoggable::
|
25
|
+
ActiveRecord::Base.extend(ActsAsLoggable::Base)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
rubygems_version: 3.
|
141
|
+
rubygems_version: 3.1.2
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Automatically log all sent emails, user logins, and page views. This also
|