paper_trail 8.0.1 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/generators/paper_trail/install_generator.rb +1 -1
- data/lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb +1 -2
- data/lib/paper_trail/has_paper_trail.rb +0 -1
- data/lib/paper_trail/model_config.rb +0 -7
- data/lib/paper_trail/version_number.rb +2 -2
- metadata +37 -32
- data/lib/paper_trail/attribute_serializers/legacy_active_record_shim.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 35be7a120b219b65fcc01eaad84678dcb9f3400bf91202e08965d32b08ca0f4c
|
4
|
+
data.tar.gz: 07924178fab1058f7ee256722ae2370dc2f424cb2821af79dd45f58449f08ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7cf8bf09991e914d93ff7a0983d9143c479fddeb57cf7a0eb9e0833aa8c6a7162576b287823aedaf9cef3376bf7a337c0780fc24e02b66562f02c38ef8b12e3
|
7
|
+
data.tar.gz: 0cfa94e51ea6609874cf8fd86caee523fe3231da5ef067c03d6f01fb9c848d44a5e46ca02a2cb759a6cc02e7b75749270eac3eb63221dfa9aa5efbdd893bff9a
|
@@ -43,7 +43,7 @@ module PaperTrail
|
|
43
43
|
def create_initializer
|
44
44
|
create_file(
|
45
45
|
"config/initializers/paper_trail.rb",
|
46
|
-
"PaperTrail.config.track_associations = #{!!options.with_associations?}"
|
46
|
+
"PaperTrail.config.track_associations = #{!!options.with_associations?}\n"
|
47
47
|
)
|
48
48
|
end
|
49
49
|
|
@@ -6,8 +6,7 @@ module PaperTrail
|
|
6
6
|
# to an attribute of type `ActiveRecord::Type::Integer`.
|
7
7
|
#
|
8
8
|
# This implementation depends on the `type_for_attribute` method, which was
|
9
|
-
# introduced in rails 4.2.
|
10
|
-
# with `LegacyActiveRecordShim`.
|
9
|
+
# introduced in rails 4.2. As of PT 8, we no longer support rails < 4.2.
|
11
10
|
class CastAttributeSerializer
|
12
11
|
def initialize(klass)
|
13
12
|
@klass = klass
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "active_support/core_ext/object" # provides the `try` method
|
2
|
-
require "paper_trail/attribute_serializers/legacy_active_record_shim"
|
3
2
|
require "paper_trail/attribute_serializers/object_attribute"
|
4
3
|
require "paper_trail/attribute_serializers/object_changes_attribute"
|
5
4
|
require "paper_trail/model_config"
|
@@ -79,13 +79,6 @@ module PaperTrail
|
|
79
79
|
options[:on] ||= %i[create update destroy]
|
80
80
|
options[:on] = Array(options[:on]) # Support single symbol
|
81
81
|
@model_class.send :include, ::PaperTrail::Model::InstanceMethods
|
82
|
-
if ::ActiveRecord::VERSION::STRING < "4.2"
|
83
|
-
::ActiveSupport::Deprecation.warn(
|
84
|
-
"Your version of ActiveRecord (< 4.2) has reached EOL. PaperTrail " \
|
85
|
-
"will soon drop support. Please upgrade ActiveRecord ASAP."
|
86
|
-
)
|
87
|
-
@model_class.send :extend, AttributeSerializers::LegacyActiveRecordShim
|
88
|
-
end
|
89
82
|
setup_options(options)
|
90
83
|
setup_associations(options)
|
91
84
|
setup_transaction_callbacks
|
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: 8.0
|
4
|
+
version: 8.1.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: 2017-
|
13
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -60,6 +60,20 @@ dependencies:
|
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '2.2'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: byebug
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '9.1'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '9.1'
|
63
77
|
- !ruby/object:Gem::Dependency
|
64
78
|
name: database_cleaner
|
65
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,14 +122,14 @@ dependencies:
|
|
108
122
|
requirements:
|
109
123
|
- - "~>"
|
110
124
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0.4.
|
125
|
+
version: 0.4.10
|
112
126
|
type: :development
|
113
127
|
prerelease: false
|
114
128
|
version_requirements: !ruby/object:Gem::Requirement
|
115
129
|
requirements:
|
116
130
|
- - "~>"
|
117
131
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0.4.
|
132
|
+
version: 0.4.10
|
119
133
|
- !ruby/object:Gem::Dependency
|
120
134
|
name: pg
|
121
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,90 +144,82 @@ dependencies:
|
|
130
144
|
- - "~>"
|
131
145
|
- !ruby/object:Gem::Version
|
132
146
|
version: 0.21.0
|
133
|
-
- !ruby/object:Gem::Dependency
|
134
|
-
name: pry-byebug
|
135
|
-
requirement: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - "~>"
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '3.5'
|
140
|
-
type: :development
|
141
|
-
prerelease: false
|
142
|
-
version_requirements: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - "~>"
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '3.5'
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: rack-test
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: 0.6.3
|
154
|
+
- - "<"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0.9'
|
154
157
|
type: :development
|
155
158
|
prerelease: false
|
156
159
|
version_requirements: !ruby/object:Gem::Requirement
|
157
160
|
requirements:
|
158
|
-
- - "
|
161
|
+
- - ">="
|
159
162
|
- !ruby/object:Gem::Version
|
160
163
|
version: 0.6.3
|
164
|
+
- - "<"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.9'
|
161
167
|
- !ruby/object:Gem::Dependency
|
162
168
|
name: rake
|
163
169
|
requirement: !ruby/object:Gem::Requirement
|
164
170
|
requirements:
|
165
171
|
- - "~>"
|
166
172
|
- !ruby/object:Gem::Version
|
167
|
-
version: '12.
|
173
|
+
version: '12.3'
|
168
174
|
type: :development
|
169
175
|
prerelease: false
|
170
176
|
version_requirements: !ruby/object:Gem::Requirement
|
171
177
|
requirements:
|
172
178
|
- - "~>"
|
173
179
|
- !ruby/object:Gem::Version
|
174
|
-
version: '12.
|
180
|
+
version: '12.3'
|
175
181
|
- !ruby/object:Gem::Dependency
|
176
182
|
name: rspec-rails
|
177
183
|
requirement: !ruby/object:Gem::Requirement
|
178
184
|
requirements:
|
179
185
|
- - "~>"
|
180
186
|
- !ruby/object:Gem::Version
|
181
|
-
version: 3.7.
|
187
|
+
version: 3.7.2
|
182
188
|
type: :development
|
183
189
|
prerelease: false
|
184
190
|
version_requirements: !ruby/object:Gem::Requirement
|
185
191
|
requirements:
|
186
192
|
- - "~>"
|
187
193
|
- !ruby/object:Gem::Version
|
188
|
-
version: 3.7.
|
194
|
+
version: 3.7.2
|
189
195
|
- !ruby/object:Gem::Dependency
|
190
196
|
name: rubocop
|
191
197
|
requirement: !ruby/object:Gem::Requirement
|
192
198
|
requirements:
|
193
|
-
- -
|
199
|
+
- - "~>"
|
194
200
|
- !ruby/object:Gem::Version
|
195
|
-
version: 0.
|
201
|
+
version: 0.51.0
|
196
202
|
type: :development
|
197
203
|
prerelease: false
|
198
204
|
version_requirements: !ruby/object:Gem::Requirement
|
199
205
|
requirements:
|
200
|
-
- -
|
206
|
+
- - "~>"
|
201
207
|
- !ruby/object:Gem::Version
|
202
|
-
version: 0.
|
208
|
+
version: 0.51.0
|
203
209
|
- !ruby/object:Gem::Dependency
|
204
210
|
name: rubocop-rspec
|
205
211
|
requirement: !ruby/object:Gem::Requirement
|
206
212
|
requirements:
|
207
213
|
- - "~>"
|
208
214
|
- !ruby/object:Gem::Version
|
209
|
-
version: 1.
|
215
|
+
version: 1.19.0
|
210
216
|
type: :development
|
211
217
|
prerelease: false
|
212
218
|
version_requirements: !ruby/object:Gem::Requirement
|
213
219
|
requirements:
|
214
220
|
- - "~>"
|
215
221
|
- !ruby/object:Gem::Version
|
216
|
-
version: 1.
|
222
|
+
version: 1.19.0
|
217
223
|
- !ruby/object:Gem::Dependency
|
218
224
|
name: sqlite3
|
219
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -260,7 +266,6 @@ files:
|
|
260
266
|
- lib/paper_trail.rb
|
261
267
|
- lib/paper_trail/attribute_serializers/README.md
|
262
268
|
- lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb
|
263
|
-
- lib/paper_trail/attribute_serializers/legacy_active_record_shim.rb
|
264
269
|
- lib/paper_trail/attribute_serializers/object_attribute.rb
|
265
270
|
- lib/paper_trail/attribute_serializers/object_changes_attribute.rb
|
266
271
|
- lib/paper_trail/cleaner.rb
|
@@ -311,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
311
316
|
version: 1.3.6
|
312
317
|
requirements: []
|
313
318
|
rubyforge_project:
|
314
|
-
rubygems_version: 2.
|
319
|
+
rubygems_version: 2.7.2
|
315
320
|
signing_key:
|
316
321
|
specification_version: 4
|
317
322
|
summary: Track changes to your models.
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module PaperTrail
|
2
|
-
module AttributeSerializers
|
3
|
-
# Included into model if AR version is < 4.2. Backport Rails 4.2 and later's
|
4
|
-
# `type_for_attribute` so we can build on a common interface.
|
5
|
-
module LegacyActiveRecordShim
|
6
|
-
# An attribute which needs no processing. It is part of our backport (shim)
|
7
|
-
# of rails 4.2's attribute API. See `type_for_attribute` below.
|
8
|
-
class NoOpAttribute
|
9
|
-
def type_cast_for_database(value)
|
10
|
-
value
|
11
|
-
end
|
12
|
-
|
13
|
-
def type_cast_from_database(data)
|
14
|
-
data
|
15
|
-
end
|
16
|
-
end
|
17
|
-
NO_OP_ATTRIBUTE = NoOpAttribute.new
|
18
|
-
|
19
|
-
# An attribute which requires manual (de)serialization to/from what we get
|
20
|
-
# from the database. It is part of our backport (shim) of rails 4.2's
|
21
|
-
# attribute API. See `type_for_attribute` below.
|
22
|
-
class SerializedAttribute
|
23
|
-
def initialize(coder)
|
24
|
-
@coder = coder.respond_to?(:dump) ? coder : PaperTrail.serializer
|
25
|
-
end
|
26
|
-
|
27
|
-
def type_cast_for_database(value)
|
28
|
-
@coder.dump(value)
|
29
|
-
end
|
30
|
-
|
31
|
-
def type_cast_from_database(data)
|
32
|
-
@coder.load(data)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def type_for_attribute(attr_name)
|
37
|
-
serialized_attribute_types[attr_name.to_s] || NO_OP_ATTRIBUTE
|
38
|
-
end
|
39
|
-
|
40
|
-
def serialized_attribute_types
|
41
|
-
@attribute_types ||= Hash[serialized_attributes.map do |attr_name, coder|
|
42
|
-
[attr_name, SerializedAttribute.new(coder)]
|
43
|
-
end]
|
44
|
-
end
|
45
|
-
private :serialized_attribute_types
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|