paper_trail 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -2
- data/README.md +7 -6
- data/doc/warning_about_not_setting_whodunnit.md +3 -3
- data/lib/paper_trail.rb +7 -0
- data/lib/paper_trail/config.rb +14 -1
- data/lib/paper_trail/version_number.rb +1 -1
- data/paper_trail.gemspec +0 -1
- data/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +0 -1
- data/test/dummy/db/schema.rb +1 -2
- data/test/test_helper.rb +0 -2
- data/test/unit/model_test.rb +0 -1
- metadata +2 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40131e454009216354dd82f76bfab5ecbc465efb
|
4
|
+
data.tar.gz: b1cbd97963f0ef014c90b2462eceaac5e6df2e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42138b9e11f51e210cc11af893b77f1834727c4280dd522ef28465856f3af0072d7065c3a906ccdfcb28ee50d80eefa7535033a6c65a612287ea0d89cd7faf58
|
7
|
+
data.tar.gz: 8a54e81675b6954778ebd715f596886991a47aba63fb0cf3a549be9410947e181a4084b323c64d156c8587306f2c2d6aec557479f3466dada0c34feefc400177
|
data/CHANGELOG.md
CHANGED
@@ -19,6 +19,24 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
|
|
19
19
|
|
20
20
|
### Fixed
|
21
21
|
|
22
|
+
## 5.2.2 (2016-09-08)
|
23
|
+
|
24
|
+
### Breaking Changes
|
25
|
+
|
26
|
+
- None
|
27
|
+
|
28
|
+
### Deprecated
|
29
|
+
|
30
|
+
- [#863](https://github.com/airblade/paper_trail/pull/863)
|
31
|
+
PaperTrail.timestamp_field= deprecated without replacement.
|
32
|
+
See [#861](https://github.com/airblade/paper_trail/pull/861) for discussion.
|
33
|
+
|
34
|
+
### Added
|
35
|
+
|
36
|
+
- None
|
37
|
+
|
38
|
+
### Fixed
|
39
|
+
|
22
40
|
## 5.2.1 (2016-09-02)
|
23
41
|
|
24
42
|
### Breaking Changes
|
@@ -129,8 +147,8 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
|
|
129
147
|
- [#556](https://github.com/airblade/paper_trail/pull/556) /
|
130
148
|
[#301](https://github.com/airblade/paper_trail/issues/301) -
|
131
149
|
If you are tracking who is responsible for changes with `whodunnit`, be aware
|
132
|
-
that PaperTrail no longer adds the `set_paper_trail_whodunnit`
|
133
|
-
for you. Please add this
|
150
|
+
that PaperTrail no longer adds the `set_paper_trail_whodunnit` before_action
|
151
|
+
for you. Please add this before_action to your ApplicationController to
|
134
152
|
continue recording whodunnit. See the readme for an example.
|
135
153
|
- [#683](https://github.com/airblade/paper_trail/pull/683) /
|
136
154
|
[#682](https://github.com/airblade/paper_trail/issues/682) -
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ has been destroyed.
|
|
11
11
|
| Version | Documentation |
|
12
12
|
| -------------- | ------------- |
|
13
13
|
| Unreleased | https://github.com/airblade/paper_trail/blob/master/README.md |
|
14
|
-
| 5.2.
|
14
|
+
| 5.2.2 | https://github.com/airblade/paper_trail/blob/v5.2.2/README.md |
|
15
15
|
| 4.2.0 | https://github.com/airblade/paper_trail/blob/v4.2.0/README.md |
|
16
16
|
| 3.0.9 | https://github.com/airblade/paper_trail/blob/v3.0.9/README.md |
|
17
17
|
| 2.7.2 | https://github.com/airblade/paper_trail/blob/v2.7.2/README.md |
|
@@ -57,7 +57,8 @@ has been destroyed.
|
|
57
57
|
|
58
58
|
| paper_trail | branch | tags | ruby | activerecord |
|
59
59
|
| -------------- | ---------- | ------ | -------- | ------------ |
|
60
|
-
|
|
60
|
+
| 6 (unreleased) | master | | >= 1.9.3 | >= 3.0, < 6 |
|
61
|
+
| 5 | 5-stable | v5.x | >= 1.9.3 | >= 3.0, < 6 |
|
61
62
|
| 4 | 4-stable | v4.x | >= 1.8.7 | >= 3.0, < 6 |
|
62
63
|
| 3 | 3.0-stable | v3.x | >= 1.8.7 | >= 3.0, < 5 |
|
63
64
|
| 2 | 2.7-stable | v2.x | >= 1.8.7 | >= 3.0, < 4 |
|
@@ -94,7 +95,7 @@ by adding a controller callback.
|
|
94
95
|
|
95
96
|
```ruby
|
96
97
|
class ApplicationController
|
97
|
-
|
98
|
+
before_action :set_paper_trail_whodunnit
|
98
99
|
end
|
99
100
|
```
|
100
101
|
|
@@ -691,12 +692,12 @@ widget.versions.last.whodunnit # Andy Stewart
|
|
691
692
|
```
|
692
693
|
|
693
694
|
If your controller has a `current_user` method, PaperTrail provides a
|
694
|
-
`
|
695
|
-
You can add this `
|
695
|
+
`before_action` that will assign `current_user.id` to `PaperTrail.whodunnit`.
|
696
|
+
You can add this `before_action` to your `ApplicationController`.
|
696
697
|
|
697
698
|
```ruby
|
698
699
|
class ApplicationController
|
699
|
-
|
700
|
+
before_action :set_paper_trail_whodunnit
|
700
701
|
end
|
701
702
|
```
|
702
703
|
|
@@ -3,12 +3,12 @@
|
|
3
3
|
After upgrading to PaperTrail 5, you see this warning:
|
4
4
|
|
5
5
|
> user_for_paper_trail is present, but whodunnit has not been set. PaperTrail no
|
6
|
-
> longer adds the set_paper_trail_whodunnit
|
7
|
-
>
|
6
|
+
> longer adds the set_paper_trail_whodunnit before_action for you. Please add this
|
7
|
+
> before_action to your ApplicationController to continue recording whodunnit.
|
8
8
|
|
9
9
|
## You want to track whodunnit
|
10
10
|
|
11
|
-
Add the set_paper_trail_whodunnit
|
11
|
+
Add the set_paper_trail_whodunnit before_action to your ApplicationController.
|
12
12
|
See the PaperTrail readme for an example (https://git.io/vrsbt).
|
13
13
|
|
14
14
|
## You don't want to track whodunnit
|
data/lib/paper_trail.rb
CHANGED
@@ -72,12 +72,19 @@ module PaperTrail
|
|
72
72
|
|
73
73
|
# Set the field which records when a version was created.
|
74
74
|
# @api public
|
75
|
+
# @deprecated
|
75
76
|
def timestamp_field=(field_name)
|
77
|
+
::ActiveSupport::Deprecation.warn(
|
78
|
+
"PaperTrail.timestamp_field= is deprecated without replacement." \
|
79
|
+
"See https://github.com/airblade/paper_trail/pull/861 for discussion",
|
80
|
+
caller(1)
|
81
|
+
)
|
76
82
|
PaperTrail.config.timestamp_field = field_name
|
77
83
|
end
|
78
84
|
|
79
85
|
# Returns the field which records when a version was created.
|
80
86
|
# @api public
|
87
|
+
# @deprecated
|
81
88
|
def timestamp_field
|
82
89
|
PaperTrail.config.timestamp_field
|
83
90
|
end
|
data/lib/paper_trail/config.rb
CHANGED
@@ -6,7 +6,8 @@ module PaperTrail
|
|
6
6
|
# configuration can be found in `paper_trail.rb`, others in `controller.rb`.
|
7
7
|
class Config
|
8
8
|
include Singleton
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :serializer, :version_limit
|
10
|
+
attr_reader :timestamp_field # deprecated
|
10
11
|
attr_writer :track_associations
|
11
12
|
|
12
13
|
def initialize
|
@@ -34,6 +35,18 @@ module PaperTrail
|
|
34
35
|
)
|
35
36
|
end
|
36
37
|
|
38
|
+
# Set the field which records when a version was created.
|
39
|
+
# @api public
|
40
|
+
# @deprecated
|
41
|
+
def timestamp_field=(field_name)
|
42
|
+
::ActiveSupport::Deprecation.warn(
|
43
|
+
"PaperTrail.config.timestamp_field= is deprecated without replacement." \
|
44
|
+
"See https://github.com/airblade/paper_trail/pull/861 for discussion",
|
45
|
+
caller(1)
|
46
|
+
)
|
47
|
+
@timestamp_field = field_name
|
48
|
+
end
|
49
|
+
|
37
50
|
# Previously, we checked `PaperTrail::VersionAssociation.table_exists?`
|
38
51
|
# here, but that proved to be problematic in situations when the database
|
39
52
|
# connection had not been established, or when the database does not exist
|
data/paper_trail.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.required_ruby_version = ">= 1.9.3"
|
22
22
|
|
23
23
|
s.add_dependency "activerecord", [">= 3.0", "< 6.0"]
|
24
|
-
s.add_dependency "activesupport", [">= 3.0", "< 6.0"]
|
25
24
|
s.add_dependency "request_store", "~> 1.1"
|
26
25
|
|
27
26
|
s.add_development_dependency "appraisal", "~> 2.1"
|
data/test/dummy/db/schema.rb
CHANGED
@@ -250,12 +250,11 @@ ActiveRecord::Schema.define(version: 20110208155312) do
|
|
250
250
|
t.text "a_text"
|
251
251
|
t.integer "an_integer"
|
252
252
|
t.float "a_float"
|
253
|
-
t.decimal "a_decimal",
|
253
|
+
t.decimal "a_decimal", precision: 6, scale: 4
|
254
254
|
t.datetime "a_datetime"
|
255
255
|
t.time "a_time"
|
256
256
|
t.date "a_date"
|
257
257
|
t.boolean "a_boolean"
|
258
|
-
t.string "sacrificial_column"
|
259
258
|
t.string "type"
|
260
259
|
t.datetime "created_at"
|
261
260
|
t.datetime "updated_at"
|
data/test/test_helper.rb
CHANGED
@@ -95,7 +95,6 @@ end
|
|
95
95
|
def change_schema
|
96
96
|
ActiveRecord::Migration.verbose = false
|
97
97
|
ActiveRecord::Schema.define do
|
98
|
-
remove_column :widgets, :sacrificial_column
|
99
98
|
add_column :versions, :custom_created_at, :datetime
|
100
99
|
end
|
101
100
|
ActiveRecord::Migration.verbose = true
|
@@ -121,7 +120,6 @@ end
|
|
121
120
|
def restore_schema
|
122
121
|
ActiveRecord::Migration.verbose = false
|
123
122
|
ActiveRecord::Schema.define do
|
124
|
-
add_column :widgets, :sacrificial_column, :string
|
125
123
|
remove_column :versions, :custom_created_at
|
126
124
|
end
|
127
125
|
ActiveRecord::Migration.verbose = true
|
data/test/unit/model_test.rb
CHANGED
@@ -520,7 +520,6 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
|
|
520
520
|
change_schema
|
521
521
|
Widget.connection.schema_cache.clear!
|
522
522
|
Widget.reset_column_information
|
523
|
-
assert_raise(NoMethodError) { Widget.new.sacrificial_column }
|
524
523
|
@last = @widget.versions.last
|
525
524
|
end
|
526
525
|
|
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: 5.2.
|
4
|
+
version: 5.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Stewart
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -31,26 +31,6 @@ dependencies:
|
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '6.0'
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: activesupport
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.0'
|
41
|
-
- - "<"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '6.0'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '3.0'
|
51
|
-
- - "<"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '6.0'
|
54
34
|
- !ruby/object:Gem::Dependency
|
55
35
|
name: request_store
|
56
36
|
requirement: !ruby/object:Gem::Requirement
|