audited 5.7.0 → 5.8.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: 954d29bc806e5a8e953599ce9fe59d04d52ade8e2847a9335d2cdaf2c077bfb9
4
- data.tar.gz: b14efe205c85e13bd23bd9041e8b19b36de9b165d580831a564fb628180727bd
3
+ metadata.gz: e0bfd7a5ca6d490f0462b5605cca4406ee60edbc1684953a3262f1395662b1a4
4
+ data.tar.gz: 4bf6e8845875c22900eb94d9dc0cfd73ddb0f065e379b59648bbd1555f3a0db8
5
5
  SHA512:
6
- metadata.gz: 45dc07b6e27f6d541867cb40497780e0a03b4f58900d013f39c68ffc8b02c5e988b4610df9db9453b130d46ee8fa738ab8f9840008b03066b9dc409d3500f4a8
7
- data.tar.gz: e2dc409665f3703e6364d9192444cd84b284ee413ef4a38f6bfacbd6a46e9e51251b8b402e2bac7cbdf8bfc41e84265ba0417a92eb78715cb503c457cc5597a0
6
+ metadata.gz: ce188b4c71689ef96dce51e1affb292dc5f98c8fee625241e6d929ed361887bfa4643c975ac7ce031eddff2956dcfbc5bf4e630f58fa9f5a4bb46e6f06d05d9e
7
+ data.tar.gz: 305b28ac6501b9bc159fdab34fbd013202e797669072721ce7cb765ad7f7a779ae9893e3ad1eab634d6a7be785c658c4a7b7e8ee1baceb48683ad6a1e1f67b78
data/Appraisals CHANGED
@@ -44,3 +44,17 @@ appraise "rails72" do
44
44
  gem "pg", "~> 1.1"
45
45
  gem "sqlite3", ">= 1.4"
46
46
  end
47
+
48
+ appraise "rails80" do
49
+ gem "rails", "~> 8.0.0"
50
+ gem "mysql2", "~> 0.5"
51
+ gem "pg", "~> 1.1"
52
+ gem "sqlite3", ">= 1.4"
53
+ end
54
+
55
+ appraise "rails_main" do
56
+ gem "rails", github: "rails/rails", branch: "main"
57
+ gem "mysql2", "~> 0.5"
58
+ gem "pg", "~> 1.1"
59
+ gem "sqlite3", ">= 2.0"
60
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Audited ChangeLog
2
2
 
3
+ ### 5.8.0 (2024-11-08)
4
+ - Allow calling audited multiple times - @mohammednasser-32
5
+ [734](https://github.com/collectiveidea/audited/pull/734)
6
+ - Relax gemspec to allow Rails 8.1 - @BranLiang
7
+ [738](https://github.com/collectiveidea/audited/pull/738)
8
+
3
9
  ### 5.7.0 (2024-08-13)
4
10
 
5
11
  - Support for Rails 7.2 and Ruby 3.3, and testing cleanups - @mattbrictson
data/audited.gemspec CHANGED
@@ -16,11 +16,11 @@ Gem::Specification.new do |gem|
16
16
 
17
17
  gem.required_ruby_version = ">= 2.3.0"
18
18
 
19
- gem.add_dependency "activerecord", ">= 5.2", "< 8.0"
20
- gem.add_dependency "activesupport", ">= 5.2", "< 8.0"
19
+ gem.add_dependency "activerecord", ">= 5.2", "< 8.2"
20
+ gem.add_dependency "activesupport", ">= 5.2", "< 8.2"
21
21
 
22
22
  gem.add_development_dependency "appraisal"
23
- gem.add_development_dependency "rails", ">= 5.2", "< 8.0"
23
+ gem.add_development_dependency "rails", ">= 5.2", "< 8.2"
24
24
  gem.add_development_dependency "rspec-rails"
25
25
  gem.add_development_dependency "standard"
26
26
  gem.add_development_dependency "single_cov"
@@ -59,9 +59,16 @@ module Audited
59
59
  # end
60
60
  #
61
61
  def audited(options = {})
62
- # don't allow multiple calls
63
- return if included_modules.include?(Audited::Auditor::AuditedInstanceMethods)
62
+ audited? ? update_audited_options(options) : set_audit(options)
63
+ end
64
+
65
+ private
66
+
67
+ def audited?
68
+ included_modules.include?(Audited::Auditor::AuditedInstanceMethods)
69
+ end
64
70
 
71
+ def set_audit(options)
65
72
  extend Audited::Auditor::AuditedClassMethods
66
73
  include Audited::Auditor::AuditedInstanceMethods
67
74
 
@@ -69,10 +76,7 @@ module Audited
69
76
  class_attribute :audited_options, instance_writer: false
70
77
  attr_accessor :audit_version, :audit_comment
71
78
 
72
- self.audited_options = options
73
- normalize_audited_options
74
-
75
- self.audit_associated_with = audited_options[:associated_with]
79
+ set_audited_options(options)
76
80
 
77
81
  if audited_options[:comment_required]
78
82
  validate :presence_of_audit_comment
@@ -100,6 +104,18 @@ module Audited
100
104
  def has_associated_audits
101
105
  has_many :associated_audits, as: :associated, class_name: Audited.audit_class.name
102
106
  end
107
+
108
+ def update_audited_options(new_options)
109
+ previous_audit_options = self.audited_options
110
+ set_audited_options(new_options)
111
+ self.reset_audited_columns
112
+ end
113
+
114
+ def set_audited_options(options)
115
+ self.audited_options = options
116
+ normalize_audited_options
117
+ self.audit_associated_with = audited_options[:associated_with]
118
+ end
103
119
  end
104
120
 
105
121
  module AuditedInstanceMethods
@@ -530,6 +546,11 @@ module Audited
530
546
  def class_auditing_enabled
531
547
  Audited.store.fetch("#{table_name}_auditing_enabled", true)
532
548
  end
549
+
550
+ def reset_audited_columns
551
+ @audited_columns = nil
552
+ @non_audited_columns = nil
553
+ end
533
554
  end
534
555
  end
535
556
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Audited
4
- VERSION = "5.7.0"
4
+ VERSION = "5.8.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audited
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.0
4
+ version: 5.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2024-08-13 00:00:00.000000000 Z
16
+ date: 2024-11-08 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activerecord
@@ -24,7 +24,7 @@ dependencies:
24
24
  version: '5.2'
25
25
  - - "<"
26
26
  - !ruby/object:Gem::Version
27
- version: '8.0'
27
+ version: '8.2'
28
28
  type: :runtime
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: '5.2'
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '8.0'
37
+ version: '8.2'
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: activesupport
40
40
  requirement: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '5.2'
45
45
  - - "<"
46
46
  - !ruby/object:Gem::Version
47
- version: '8.0'
47
+ version: '8.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '5.2'
55
55
  - - "<"
56
56
  - !ruby/object:Gem::Version
57
- version: '8.0'
57
+ version: '8.2'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: appraisal
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -78,7 +78,7 @@ dependencies:
78
78
  version: '5.2'
79
79
  - - "<"
80
80
  - !ruby/object:Gem::Version
81
- version: '8.0'
81
+ version: '8.2'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
@@ -88,7 +88,7 @@ dependencies:
88
88
  version: '5.2'
89
89
  - - "<"
90
90
  - !ruby/object:Gem::Version
91
- version: '8.0'
91
+ version: '8.2'
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rspec-rails
94
94
  requirement: !ruby/object:Gem::Requirement
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  - !ruby/object:Gem::Version
234
234
  version: '0'
235
235
  requirements: []
236
- rubygems_version: 3.5.11
236
+ rubygems_version: 3.5.22
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: Log all changes to your models