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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7f4fc3d49401f3b6662c151df50c0950d3a6679fcb8e5e8a157faa6e442f8ae
4
- data.tar.gz: b650b9465adbaeae418d3d9860ec5a83fa3bd16cc465127322d56de4e15f3bb5
3
+ metadata.gz: bd43bfe19f220a08425b7f93f3160ef4d2fa4107e6eb8c7d00d7e92dff2ede90
4
+ data.tar.gz: 3d0a977bcff9579e325523aa03472b107d028f2076197e947913b6b4d64df4c7
5
5
  SHA512:
6
- metadata.gz: 6eb6deb9117fc08a647a68e0a2c76d7de045e2a3fd2b297f69eb94dac549b1d93d9457723261772f7ca426dabcbd62d9b002265d31f8442487e196970957d5b3
7
- data.tar.gz: 4f70acc13305458ec9a8154c1bb3846834660de3ee3bab3a3280264aaa83b83973615b01fcb16c372aadc7b6ee33e5e69af8543efc65e8d63b35fa5c78904ca1
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, -> { EffectiveLogging.Log.order(:id).where(status: EffectiveLogging.log_changes_status) }, as: :changes_to
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)
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '4.1.3'.freeze
2
+ VERSION = '4.2.0'.freeze
3
3
  end
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.1.3
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-01-30 00:00:00.000000000 Z
11
+ date: 2024-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails