paper_trail 11.0.0 → 12.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +20 -0
  3. data/lib/generators/paper_trail/install/install_generator.rb +6 -4
  4. data/lib/generators/paper_trail/install/templates/create_versions.rb.erb +3 -1
  5. data/lib/generators/paper_trail/update_item_subtype/update_item_subtype_generator.rb +4 -2
  6. data/lib/paper_trail/attribute_serializers/attribute_serializer_factory.rb +24 -10
  7. data/lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb +10 -10
  8. data/lib/paper_trail/compatibility.rb +2 -2
  9. data/lib/paper_trail/errors.rb +33 -0
  10. data/lib/paper_trail/events/base.rb +60 -63
  11. data/lib/paper_trail/events/destroy.rb +1 -1
  12. data/lib/paper_trail/events/update.rb +9 -4
  13. data/lib/paper_trail/frameworks/active_record.rb +9 -2
  14. data/lib/paper_trail/frameworks/rails/controller.rb +0 -6
  15. data/lib/paper_trail/frameworks/rails/railtie.rb +30 -0
  16. data/lib/paper_trail/frameworks/rails.rb +1 -2
  17. data/lib/paper_trail/has_paper_trail.rb +1 -1
  18. data/lib/paper_trail/model_config.rb +51 -43
  19. data/lib/paper_trail/queries/versions/where_attribute_changes.rb +50 -0
  20. data/lib/paper_trail/queries/versions/where_object.rb +1 -1
  21. data/lib/paper_trail/queries/versions/where_object_changes.rb +8 -13
  22. data/lib/paper_trail/queries/versions/where_object_changes_from.rb +57 -0
  23. data/lib/paper_trail/queries/versions/where_object_changes_to.rb +57 -0
  24. data/lib/paper_trail/record_trail.rb +3 -5
  25. data/lib/paper_trail/reifier.rb +27 -10
  26. data/lib/paper_trail/request.rb +0 -3
  27. data/lib/paper_trail/serializers/json.rb +0 -10
  28. data/lib/paper_trail/serializers/yaml.rb +1 -13
  29. data/lib/paper_trail/type_serializers/postgres_array_serializer.rb +1 -14
  30. data/lib/paper_trail/version_concern.rb +64 -21
  31. data/lib/paper_trail/version_number.rb +2 -2
  32. data/lib/paper_trail.rb +17 -40
  33. metadata +102 -33
  34. data/lib/paper_trail/frameworks/rails/engine.rb +0 -45
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "paper_trail/attribute_serializers/object_changes_attribute"
4
+ require "paper_trail/queries/versions/where_attribute_changes"
4
5
  require "paper_trail/queries/versions/where_object"
5
6
  require "paper_trail/queries/versions/where_object_changes"
7
+ require "paper_trail/queries/versions/where_object_changes_from"
8
+ require "paper_trail/queries/versions/where_object_changes_to"
6
9
 
7
10
  module PaperTrail
8
11
  # Originally, PaperTrail did not provide this module, and all of this
@@ -13,22 +16,13 @@ module PaperTrail
13
16
  extend ::ActiveSupport::Concern
14
17
 
15
18
  included do
16
- if ::ActiveRecord.gem_version >= Gem::Version.new("5.0")
17
- belongs_to :item, polymorphic: true, optional: true
18
- else
19
- belongs_to :item, polymorphic: true
20
- end
21
-
19
+ belongs_to :item, polymorphic: true, optional: true, inverse_of: false
22
20
  validates_presence_of :event
23
21
  after_create :enforce_version_limit!
24
22
  end
25
23
 
26
24
  # :nodoc:
27
25
  module ClassMethods
28
- def item_subtype_column_present?
29
- column_names.include?("item_subtype")
30
- end
31
-
32
26
  def with_item_keys(item_type, item_id)
33
27
  where item_type: item_type, item_id: item_id
34
28
  end
@@ -46,7 +40,7 @@ module PaperTrail
46
40
  end
47
41
 
48
42
  def not_creates
49
- where "event <> ?", "create"
43
+ where.not(event: "create")
50
44
  end
51
45
 
52
46
  def between(start_time, end_time)
@@ -64,6 +58,18 @@ module PaperTrail
64
58
  end
65
59
  end
66
60
 
61
+ # Given an attribute like `"name"`, query the `versions.object_changes`
62
+ # column for any changes that modified the provided attribute.
63
+ #
64
+ # @api public
65
+ def where_attribute_changes(attribute)
66
+ unless attribute.is_a?(String) || attribute.is_a?(Symbol)
67
+ raise ArgumentError, "expected to receive a String or Symbol"
68
+ end
69
+
70
+ Queries::Versions::WhereAttributeChanges.new(self, attribute).execute
71
+ end
72
+
67
73
  # Given a hash of attributes like `name: 'Joan'`, query the
68
74
  # `versions.objects` column.
69
75
  #
@@ -120,6 +126,36 @@ module PaperTrail
120
126
  Queries::Versions::WhereObjectChanges.new(self, args).execute
121
127
  end
122
128
 
129
+ # Given a hash of attributes like `name: 'Joan'`, query the
130
+ # `versions.objects_changes` column for changes where the version changed
131
+ # from the hash of attributes to other values.
132
+ #
133
+ # This is useful for finding versions where the attribute started with a
134
+ # known value and changed to something else. This is in comparison to
135
+ # `where_object_changes` which will find both the changes before and
136
+ # after.
137
+ #
138
+ # @api public
139
+ def where_object_changes_from(args = {})
140
+ raise ArgumentError, "expected to receive a Hash" unless args.is_a?(Hash)
141
+ Queries::Versions::WhereObjectChangesFrom.new(self, args).execute
142
+ end
143
+
144
+ # Given a hash of attributes like `name: 'Joan'`, query the
145
+ # `versions.objects_changes` column for changes where the version changed
146
+ # to the hash of attributes from other values.
147
+ #
148
+ # This is useful for finding versions where the attribute started with an
149
+ # unknown value and changed to a known value. This is in comparison to
150
+ # `where_object_changes` which will find both the changes before and
151
+ # after.
152
+ #
153
+ # @api public
154
+ def where_object_changes_to(args = {})
155
+ raise ArgumentError, "expected to receive a Hash" unless args.is_a?(Hash)
156
+ Queries::Versions::WhereObjectChangesTo.new(self, args).execute
157
+ end
158
+
123
159
  def primary_key_is_int?
124
160
  @primary_key_is_int ||= columns_hash[primary_key].type == :integer
125
161
  rescue StandardError # TODO: Rescue something more specific
@@ -226,7 +262,7 @@ module PaperTrail
226
262
  #
227
263
  def reify(options = {})
228
264
  unless self.class.column_names.include? "object"
229
- raise "reify can't be called without an object column"
265
+ raise Error, "reify requires an object column"
230
266
  end
231
267
  return nil if object.nil?
232
268
  ::PaperTrail::Reifier.reify(self, options)
@@ -273,7 +309,7 @@ module PaperTrail
273
309
 
274
310
  # @api private
275
311
  def load_changeset
276
- if PaperTrail.config.object_changes_adapter&.respond_to?(:load_changeset)
312
+ if PaperTrail.config.object_changes_adapter.respond_to?(:load_changeset)
277
313
  return PaperTrail.config.object_changes_adapter.load_changeset(self)
278
314
  end
279
315
 
@@ -339,16 +375,23 @@ module PaperTrail
339
375
  # The version limit can be global or per-model.
340
376
  #
341
377
  # @api private
342
- #
343
- # TODO: Duplication: similar `constantize` in Reifier#version_reification_class
344
378
  def version_limit
345
- if self.class.item_subtype_column_present?
346
- klass = (item_subtype || item_type).constantize
347
- if klass&.paper_trail_options&.key?(:limit)
348
- return klass.paper_trail_options[:limit]
349
- end
379
+ klass = item.class
380
+ if limit_option?(klass)
381
+ klass.paper_trail_options[:limit]
382
+ elsif base_class_limit_option?(klass)
383
+ klass.base_class.paper_trail_options[:limit]
384
+ else
385
+ PaperTrail.config.version_limit
350
386
  end
351
- PaperTrail.config.version_limit
387
+ end
388
+
389
+ def limit_option?(klass)
390
+ klass.respond_to?(:paper_trail_options) && klass.paper_trail_options.key?(:limit)
391
+ end
392
+
393
+ def base_class_limit_option?(klass)
394
+ klass.respond_to?(:base_class) && limit_option?(klass.base_class)
352
395
  end
353
396
  end
354
397
  end
@@ -7,8 +7,8 @@ module PaperTrail
7
7
  # because of this confusion, but it's not worth the breaking change.
8
8
  # People are encouraged to use `PaperTrail.gem_version` instead.
9
9
  module VERSION
10
- MAJOR = 11
11
- MINOR = 0
10
+ MAJOR = 12
11
+ MINOR = 2
12
12
  TINY = 0
13
13
 
14
14
  # Set PRE to nil unless it's a pre-release (beta, rc, etc.)
data/lib/paper_trail.rb CHANGED
@@ -8,40 +8,26 @@
8
8
  # can revisit this decision.
9
9
  require "active_support/all"
10
10
 
11
- # AR is required for, eg. has_paper_trail.rb, so we could put this `require` in
12
- # all of those files, but it seems easier to troubleshoot if we just make sure
13
- # AR is loaded here before loading *any* of PT. See discussion of
14
- # performance/simplicity tradeoff for activesupport above.
15
- require "active_record"
16
-
17
- require "request_store"
11
+ require "paper_trail/errors"
18
12
  require "paper_trail/cleaner"
19
13
  require "paper_trail/compatibility"
20
14
  require "paper_trail/config"
21
- require "paper_trail/has_paper_trail"
22
15
  require "paper_trail/record_history"
23
- require "paper_trail/reifier"
24
16
  require "paper_trail/request"
25
- require "paper_trail/version_concern"
26
17
  require "paper_trail/version_number"
27
18
  require "paper_trail/serializers/json"
28
- require "paper_trail/serializers/yaml"
29
19
 
30
20
  # An ActiveRecord extension that tracks changes to your models, for auditing or
31
21
  # versioning.
32
22
  module PaperTrail
33
- E_RAILS_NOT_LOADED = <<-EOS.squish.freeze
34
- PaperTrail has been loaded too early, before rails is loaded. This can
35
- happen when another gem defines the ::Rails namespace, then PT is loaded,
36
- all before rails is loaded. You may want to reorder your Gemfile, or defer
37
- the loading of PT by using `require: false` and a manual require elsewhere.
38
- EOS
39
23
  E_TIMESTAMP_FIELD_CONFIG = <<-EOS.squish.freeze
40
24
  PaperTrail.timestamp_field= has been removed, without replacement. It is no
41
25
  longer configurable. The timestamp column in the versions table must now be
42
26
  named created_at.
43
27
  EOS
44
28
 
29
+ RAILS_GTE_7_0 = ::ActiveRecord.gem_version >= ::Gem::Version.new("7.0.0")
30
+
45
31
  extend PaperTrail::Cleaner
46
32
 
47
33
  class << self
@@ -85,7 +71,7 @@ module PaperTrail
85
71
  #
86
72
  # @api public
87
73
  def request(options = nil, &block)
88
- if options.nil? && !block_given?
74
+ if options.nil? && !block
89
75
  Request
90
76
  else
91
77
  Request.with(options, &block)
@@ -95,7 +81,7 @@ module PaperTrail
95
81
  # Set the field which records when a version was created.
96
82
  # @api public
97
83
  def timestamp_field=(_field_name)
98
- raise(E_TIMESTAMP_FIELD_CONFIG)
84
+ raise Error, E_TIMESTAMP_FIELD_CONFIG
99
85
  end
100
86
 
101
87
  # Set the PaperTrail serializer. This setting affects all threads.
@@ -126,27 +112,18 @@ module PaperTrail
126
112
  end
127
113
  end
128
114
 
129
- # We use the `on_load` "hook" instead of `ActiveRecord::Base.include` because we
130
- # don't want to cause all of AR to be autloaded yet. See
131
- # https://guides.rubyonrails.org/engines.html#what-are-on-load-hooks-questionmark
132
- # to learn more about `on_load`.
133
- ActiveSupport.on_load(:active_record) do
134
- include PaperTrail::Model
135
- end
136
-
137
- # Require frameworks
138
- if defined?(::Rails)
139
- # Rails module is sometimes defined by gems like rails-html-sanitizer
140
- # so we check for presence of Rails.application.
141
- if defined?(::Rails.application)
142
- require "paper_trail/frameworks/rails"
143
- else
144
- ::Kernel.warn(::PaperTrail::E_RAILS_NOT_LOADED)
145
- end
115
+ # PT is built on ActiveRecord, but does not require Rails. If Rails is defined,
116
+ # our Railtie makes sure not to load the AR-dependent parts of PT until AR is
117
+ # ready. A typical Rails `application.rb` has:
118
+ #
119
+ # ```
120
+ # require 'rails/all' # Defines `Rails`
121
+ # Bundler.require(*Rails.groups) # require 'paper_trail' (this file)
122
+ # ```
123
+ #
124
+ # Non-rails applications should take similar care to load AR before PT.
125
+ if defined?(Rails)
126
+ require "paper_trail/frameworks/rails"
146
127
  else
147
128
  require "paper_trail/frameworks/active_record"
148
129
  end
149
-
150
- if defined?(::ActiveRecord)
151
- ::PaperTrail::Compatibility.check_activerecord(::ActiveRecord.gem_version)
152
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0
4
+ version: 12.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-08-24 00:00:00.000000000 Z
13
+ date: 2022-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -46,42 +46,42 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '2.2'
49
+ version: 2.4.1
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '2.2'
56
+ version: 2.4.1
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: byebug
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '11.0'
63
+ version: '11.1'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '11.0'
70
+ version: '11.1'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: ffaker
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '2.11'
77
+ version: '2.20'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '2.11'
84
+ version: '2.20'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: generator_spec
87
87
  requirement: !ruby/object:Gem::Requirement
@@ -102,14 +102,28 @@ dependencies:
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: 0.9.14
105
+ version: 1.0.0
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: 0.9.14
112
+ version: 1.0.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: rails
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '5.2'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '5.2'
113
127
  - !ruby/object:Gem::Dependency
114
128
  name: rake
115
129
  requirement: !ruby/object:Gem::Requirement
@@ -130,90 +144,140 @@ dependencies:
130
144
  requirements:
131
145
  - - "~>"
132
146
  - !ruby/object:Gem::Version
133
- version: '4.0'
147
+ version: 5.0.2
134
148
  type: :development
135
149
  prerelease: false
136
150
  version_requirements: !ruby/object:Gem::Requirement
137
151
  requirements:
138
152
  - - "~>"
139
153
  - !ruby/object:Gem::Version
140
- version: '4.0'
154
+ version: 5.0.2
141
155
  - !ruby/object:Gem::Dependency
142
156
  name: rubocop
143
157
  requirement: !ruby/object:Gem::Requirement
144
158
  requirements:
145
159
  - - "~>"
146
160
  - !ruby/object:Gem::Version
147
- version: 0.89.1
161
+ version: 1.22.2
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - "~>"
167
+ - !ruby/object:Gem::Version
168
+ version: 1.22.2
169
+ - !ruby/object:Gem::Dependency
170
+ name: rubocop-packaging
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - "~>"
174
+ - !ruby/object:Gem::Version
175
+ version: 0.5.1
148
176
  type: :development
149
177
  prerelease: false
150
178
  version_requirements: !ruby/object:Gem::Requirement
151
179
  requirements:
152
180
  - - "~>"
153
181
  - !ruby/object:Gem::Version
154
- version: 0.89.1
182
+ version: 0.5.1
155
183
  - !ruby/object:Gem::Dependency
156
184
  name: rubocop-performance
157
185
  requirement: !ruby/object:Gem::Requirement
158
186
  requirements:
159
187
  - - "~>"
160
188
  - !ruby/object:Gem::Version
161
- version: 1.7.1
189
+ version: 1.11.5
162
190
  type: :development
163
191
  prerelease: false
164
192
  version_requirements: !ruby/object:Gem::Requirement
165
193
  requirements:
166
194
  - - "~>"
167
195
  - !ruby/object:Gem::Version
168
- version: 1.7.1
196
+ version: 1.11.5
197
+ - !ruby/object:Gem::Dependency
198
+ name: rubocop-rails
199
+ requirement: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - "~>"
202
+ - !ruby/object:Gem::Version
203
+ version: 2.12.4
204
+ type: :development
205
+ prerelease: false
206
+ version_requirements: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - "~>"
209
+ - !ruby/object:Gem::Version
210
+ version: 2.12.4
211
+ - !ruby/object:Gem::Dependency
212
+ name: rubocop-rake
213
+ requirement: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - "~>"
216
+ - !ruby/object:Gem::Version
217
+ version: 0.6.0
218
+ type: :development
219
+ prerelease: false
220
+ version_requirements: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - "~>"
223
+ - !ruby/object:Gem::Version
224
+ version: 0.6.0
169
225
  - !ruby/object:Gem::Dependency
170
226
  name: rubocop-rspec
171
227
  requirement: !ruby/object:Gem::Requirement
172
228
  requirements:
173
229
  - - "~>"
174
230
  - !ruby/object:Gem::Version
175
- version: 1.42.0
231
+ version: 2.5.0
176
232
  type: :development
177
233
  prerelease: false
178
234
  version_requirements: !ruby/object:Gem::Requirement
179
235
  requirements:
180
236
  - - "~>"
181
237
  - !ruby/object:Gem::Version
182
- version: 1.42.0
238
+ version: 2.5.0
239
+ - !ruby/object:Gem::Dependency
240
+ name: simplecov
241
+ requirement: !ruby/object:Gem::Requirement
242
+ requirements:
243
+ - - "~>"
244
+ - !ruby/object:Gem::Version
245
+ version: 0.21.2
246
+ type: :development
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ requirements:
250
+ - - "~>"
251
+ - !ruby/object:Gem::Version
252
+ version: 0.21.2
183
253
  - !ruby/object:Gem::Dependency
184
254
  name: mysql2
185
255
  requirement: !ruby/object:Gem::Requirement
186
256
  requirements:
187
257
  - - "~>"
188
258
  - !ruby/object:Gem::Version
189
- version: '0.5'
259
+ version: 0.5.3
190
260
  type: :development
191
261
  prerelease: false
192
262
  version_requirements: !ruby/object:Gem::Requirement
193
263
  requirements:
194
264
  - - "~>"
195
265
  - !ruby/object:Gem::Version
196
- version: '0.5'
266
+ version: 0.5.3
197
267
  - !ruby/object:Gem::Dependency
198
268
  name: pg
199
269
  requirement: !ruby/object:Gem::Requirement
200
270
  requirements:
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- version: '0.18'
204
- - - "<"
271
+ - - "~>"
205
272
  - !ruby/object:Gem::Version
206
- version: '2.0'
273
+ version: '1.2'
207
274
  type: :development
208
275
  prerelease: false
209
276
  version_requirements: !ruby/object:Gem::Requirement
210
277
  requirements:
211
- - - ">="
212
- - !ruby/object:Gem::Version
213
- version: '0.18'
214
- - - "<"
278
+ - - "~>"
215
279
  - !ruby/object:Gem::Version
216
- version: '2.0'
280
+ version: '1.2'
217
281
  - !ruby/object:Gem::Dependency
218
282
  name: sqlite3
219
283
  requirement: !ruby/object:Gem::Requirement
@@ -237,6 +301,7 @@ executables: []
237
301
  extensions: []
238
302
  extra_rdoc_files: []
239
303
  files:
304
+ - LICENSE
240
305
  - lib/generators/paper_trail/install/USAGE
241
306
  - lib/generators/paper_trail/install/install_generator.rb
242
307
  - lib/generators/paper_trail/install/templates/add_object_changes_to_versions.rb.erb
@@ -254,6 +319,7 @@ files:
254
319
  - lib/paper_trail/cleaner.rb
255
320
  - lib/paper_trail/compatibility.rb
256
321
  - lib/paper_trail/config.rb
322
+ - lib/paper_trail/errors.rb
257
323
  - lib/paper_trail/events/base.rb
258
324
  - lib/paper_trail/events/create.rb
259
325
  - lib/paper_trail/events/destroy.rb
@@ -263,13 +329,16 @@ files:
263
329
  - lib/paper_trail/frameworks/cucumber.rb
264
330
  - lib/paper_trail/frameworks/rails.rb
265
331
  - lib/paper_trail/frameworks/rails/controller.rb
266
- - lib/paper_trail/frameworks/rails/engine.rb
332
+ - lib/paper_trail/frameworks/rails/railtie.rb
267
333
  - lib/paper_trail/frameworks/rspec.rb
268
334
  - lib/paper_trail/frameworks/rspec/helpers.rb
269
335
  - lib/paper_trail/has_paper_trail.rb
270
336
  - lib/paper_trail/model_config.rb
337
+ - lib/paper_trail/queries/versions/where_attribute_changes.rb
271
338
  - lib/paper_trail/queries/versions/where_object.rb
272
339
  - lib/paper_trail/queries/versions/where_object_changes.rb
340
+ - lib/paper_trail/queries/versions/where_object_changes_from.rb
341
+ - lib/paper_trail/queries/versions/where_object_changes_to.rb
273
342
  - lib/paper_trail/record_history.rb
274
343
  - lib/paper_trail/record_trail.rb
275
344
  - lib/paper_trail/reifier.rb
@@ -291,14 +360,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
291
360
  requirements:
292
361
  - - ">="
293
362
  - !ruby/object:Gem::Version
294
- version: 2.4.0
363
+ version: 2.6.0
295
364
  required_rubygems_version: !ruby/object:Gem::Requirement
296
365
  requirements:
297
366
  - - ">="
298
367
  - !ruby/object:Gem::Version
299
368
  version: 1.3.6
300
369
  requirements: []
301
- rubygems_version: 3.0.3
370
+ rubygems_version: 3.2.22
302
371
  signing_key:
303
372
  specification_version: 4
304
373
  summary: Track changes to your models.
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module PaperTrail
4
- module Rails
5
- # See http://guides.rubyonrails.org/engines.html
6
- class Engine < ::Rails::Engine
7
- DPR_CONFIG_ENABLED = <<~EOS.squish.freeze
8
- The rails configuration option config.paper_trail.enabled is deprecated.
9
- Please use PaperTrail.enabled= instead. People were getting confused
10
- that PT has both, specifically regarding *when* each was happening. If
11
- you'd like to keep config.paper_trail, join the discussion at
12
- https://github.com/paper-trail-gem/paper_trail/pull/1176
13
- EOS
14
- private_constant :DPR_CONFIG_ENABLED
15
- DPR_RUDELY_ENABLING = <<~EOS.squish.freeze
16
- At some point early in the rails boot process, you have set
17
- PaperTrail.enabled = false. PT's rails engine is now overriding your
18
- setting, and setting it to true. We're not sure why, but this is how PT
19
- has worked since 5.0, when the config.paper_trail.enabled option was
20
- introduced. This is now deprecated. In the future, PT will not override
21
- your setting. See
22
- https://github.com/paper-trail-gem/paper_trail/pull/1176 for discussion.
23
- EOS
24
- private_constant :DPR_RUDELY_ENABLING
25
-
26
- paths["app/models"] << "lib/paper_trail/frameworks/active_record/models"
27
-
28
- # --- Begin deprecated section ---
29
- config.paper_trail = ActiveSupport::OrderedOptions.new
30
- initializer "paper_trail.initialisation" do |app|
31
- enable = app.config.paper_trail[:enabled]
32
- if enable.nil?
33
- unless PaperTrail.enabled?
34
- ::ActiveSupport::Deprecation.warn(DPR_RUDELY_ENABLING)
35
- PaperTrail.enabled = true
36
- end
37
- else
38
- ::ActiveSupport::Deprecation.warn(DPR_CONFIG_ENABLED)
39
- PaperTrail.enabled = enable
40
- end
41
- end
42
- # --- End deprecated section ---
43
- end
44
- end
45
- end