effective_logging 4.1.3 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/acts_as_loggable.rb +9 -4
- data/lib/effective_logging/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd43bfe19f220a08425b7f93f3160ef4d2fa4107e6eb8c7d00d7e92dff2ede90
|
4
|
+
data.tar.gz: 3d0a977bcff9579e325523aa03472b107d028f2076197e947913b6b4d64df4c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 004220be5d784fce7fb075b9eac6a6f344d4416bfe1c9d64af6edb895b6ed1802e62cca9b52364746a2eba6b9b7b3a4418d3508f912954048d520a0e8106a5a1
|
7
|
+
data.tar.gz: d02dee405d04dd01b1bb135ecf90b7241e2feae917c911ad5785e8474eb04b5821a02e2478924c64a8b8458984c3691129bbd0265a326fef1f16350487f06ee7
|
@@ -20,7 +20,7 @@ module ActsAsLoggable
|
|
20
20
|
end
|
21
21
|
|
22
22
|
included do
|
23
|
-
has_many :logged_changes, -> {
|
23
|
+
has_many :logged_changes, -> { where(status: EffectiveLogging.log_changes_status).order(:id) }, as: :changes_to, class_name: 'Effective::Log'
|
24
24
|
|
25
25
|
log_changes_options = {
|
26
26
|
to: @acts_as_loggable_options[:to],
|
@@ -35,15 +35,15 @@ module ActsAsLoggable
|
|
35
35
|
|
36
36
|
self.send(:define_method, :log_changes_options) { log_changes_options }
|
37
37
|
|
38
|
-
after_create(unless: -> { EffectiveLogging.supressed? }) do
|
38
|
+
after_create(if: -> { log_changes? }, unless: -> { EffectiveLogging.supressed? }) do
|
39
39
|
::EffectiveLogging::ActiveRecordLogger.new(self, log_changes_options).created!
|
40
40
|
end
|
41
41
|
|
42
|
-
after_destroy(unless: -> { EffectiveLogging.supressed? }) do
|
42
|
+
after_destroy(if: -> { log_changes? }, unless: -> { EffectiveLogging.supressed? }) do
|
43
43
|
::EffectiveLogging::ActiveRecordLogger.new(self, log_changes_options).destroyed!
|
44
44
|
end
|
45
45
|
|
46
|
-
after_update(unless: -> { EffectiveLogging.supressed? }) do
|
46
|
+
after_update(if: -> { log_changes? }, unless: -> { EffectiveLogging.supressed? }) do
|
47
47
|
::EffectiveLogging::ActiveRecordLogger.new(self, log_changes_options).updated!
|
48
48
|
end
|
49
49
|
end
|
@@ -54,6 +54,11 @@ module ActsAsLoggable
|
|
54
54
|
|
55
55
|
# Regular instance methods
|
56
56
|
|
57
|
+
# Disable logging of changes for this resource
|
58
|
+
def log_changes?
|
59
|
+
true # Can be overridden to suppress logging
|
60
|
+
end
|
61
|
+
|
57
62
|
# Format the title of this attribute. Return nil to use the default attribute.titleize
|
58
63
|
def log_changes_formatted_attribute(attribute)
|
59
64
|
'Roles' if attribute == :roles_mask && defined?(EffectiveRoles) && respond_to?(:roles)
|
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: 4.
|
4
|
+
version: 4.2.0
|
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: 2024-
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|