paper_trail 5.2.3 → 6.0.0
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/.github/CONTRIBUTING.md +12 -20
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +0 -8
- data/.travis.yml +7 -5
- data/Appraisals +8 -17
- data/CHANGELOG.md +46 -0
- data/README.md +47 -26
- data/doc/triage.md +27 -0
- data/gemfiles/{ar4.gemfile → ar_4.2.gemfile} +0 -0
- data/gemfiles/{ar5.gemfile → ar_5.0.gemfile} +0 -0
- data/gemfiles/ar_master.gemfile +9 -0
- data/lib/paper_trail/cleaner.rb +1 -1
- data/lib/paper_trail/config.rb +1 -15
- data/lib/paper_trail/frameworks/rails/controller.rb +1 -1
- data/lib/paper_trail/frameworks/rspec.rb +5 -0
- data/lib/paper_trail/has_paper_trail.rb +1 -292
- data/lib/paper_trail/model_config.rb +17 -7
- data/lib/paper_trail/record_history.rb +1 -9
- data/lib/paper_trail/record_trail.rb +148 -56
- data/lib/paper_trail/version_concern.rb +7 -7
- data/lib/paper_trail/version_number.rb +3 -3
- data/lib/paper_trail.rb +5 -14
- data/paper_trail.gemspec +2 -1
- data/spec/models/widget_spec.rb +16 -3
- data/test/dummy/app/models/song.rb +27 -22
- data/test/test_helper.rb +21 -23
- data/test/unit/associations_test.rb +1 -1
- data/test/unit/cleaner_test.rb +0 -37
- data/test/unit/inheritance_column_test.rb +2 -4
- data/test/unit/model_test.rb +56 -29
- data/test/unit/serializer_test.rb +11 -12
- data/test/unit/version_test.rb +0 -7
- metadata +10 -13
- data/gemfiles/ar3.gemfile +0 -19
- data/spec/models/fluxor_spec.rb +0 -17
- data/test/unit/timestamp_test.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70bf4fda92d269f953d7e88fc0a78f72ff3e288e
|
4
|
+
data.tar.gz: 52bf0491880b3dba4905af331f84bc9de67d0bef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b139581b4bf0efa29562edc58d30e3854d746d6064c1e4d0a36204ffb1ed34c81d909eea0e6866fa42b35c34f8a3b0fef5e77858f00579bdeca50441d3c13d7
|
7
|
+
data.tar.gz: 1608f17448169a8f2084ce44782cfcac844bd6cf4faba4f283c81b5c338dbed9afc68f5b985279e35019cdb5f40f90a2835a2f9b4ed50ff1e998dc5d78471ea2
|
data/.github/CONTRIBUTING.md
CHANGED
@@ -22,17 +22,11 @@ Install gems with `bundle exec appraisal install`.
|
|
22
22
|
|
23
23
|
Testing is a little awkward because the test suite:
|
24
24
|
|
25
|
-
1. Supports
|
25
|
+
1. Supports multiple versions of rails
|
26
26
|
1. Contains a "dummy" rails app with three databases (test, foo, and bar)
|
27
27
|
1. Supports three different RDBMS': sqlite, mysql, and postgres
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
```
|
32
|
-
bundle exec appraisal ar3 rake
|
33
|
-
```
|
34
|
-
|
35
|
-
Run tests with sqlite:
|
29
|
+
### Run tests with sqlite
|
36
30
|
|
37
31
|
```
|
38
32
|
# Create the appropriate database config. file
|
@@ -47,10 +41,10 @@ RAILS_ENV=bar bundle exec rake db:setup
|
|
47
41
|
cd ../..
|
48
42
|
|
49
43
|
# Run tests
|
50
|
-
DB=sqlite bundle exec rake
|
44
|
+
DB=sqlite bundle exec appraisal ar-5.0 rake
|
51
45
|
```
|
52
46
|
|
53
|
-
Run tests with mysql
|
47
|
+
### Run tests with mysql
|
54
48
|
|
55
49
|
```
|
56
50
|
# Create the appropriate database config. file
|
@@ -65,10 +59,10 @@ RAILS_ENV=bar bundle exec rake db:setup
|
|
65
59
|
cd ../..
|
66
60
|
|
67
61
|
# Run tests
|
68
|
-
DB=mysql bundle exec rake
|
62
|
+
DB=mysql bundle exec appraisal ar-5.0 rake
|
69
63
|
```
|
70
64
|
|
71
|
-
Run tests with postgres
|
65
|
+
### Run tests with postgres
|
72
66
|
|
73
67
|
```
|
74
68
|
# Create the appropriate database config. file
|
@@ -78,19 +72,17 @@ DB=postgres bundle exec rake prepare
|
|
78
72
|
# If this is the first test run ever, create databases.
|
79
73
|
# Unlike mysql, use create/migrate instead of setup.
|
80
74
|
cd test/dummy
|
81
|
-
DB=postgres RAILS_ENV=test bundle exec rake db:create
|
82
|
-
DB=postgres RAILS_ENV=
|
83
|
-
DB=postgres RAILS_ENV=
|
84
|
-
DB=postgres RAILS_ENV=foo bundle exec rake db:migrate
|
85
|
-
DB=postgres RAILS_ENV=bar bundle exec rake db:create
|
86
|
-
DB=postgres RAILS_ENV=bar bundle exec rake db:migrate
|
75
|
+
DB=postgres RAILS_ENV=test bundle exec rake db:drop db:create db:migrate
|
76
|
+
DB=postgres RAILS_ENV=foo bundle exec rake db:drop db:create db:migrate
|
77
|
+
DB=postgres RAILS_ENV=bar bundle exec rake db:drop db:create db:migrate
|
87
78
|
cd ../..
|
88
79
|
|
89
80
|
# Run tests
|
90
81
|
DB=postgres bundle exec rake
|
82
|
+
DB=postgres bundle exec appraisal ar-5.0 rake
|
91
83
|
```
|
92
84
|
|
93
|
-
|
85
|
+
## Releases
|
94
86
|
|
95
87
|
1. Set the version in lib/paper_trail/version_number.rb
|
96
88
|
- Set PRE to nil unless it's a pre-release (beta, rc, etc.)
|
@@ -102,7 +94,7 @@ DB=postgres bundle exec rake
|
|
102
94
|
- Update version number(s) in the documentation links table
|
103
95
|
1. Commit
|
104
96
|
1. git tag -a -m "v5.0.0" "v5.0.0" # or whatever number
|
105
|
-
1. git push --tags origin
|
97
|
+
1. git push --tags origin 5-stable # or whatever branch
|
106
98
|
1. gem build paper_trail.gemspec
|
107
99
|
1. gem push paper_trail-5.0.0.gem
|
108
100
|
|
data/.rubocop.yml
CHANGED
@@ -20,6 +20,10 @@ Metrics/AbcSize:
|
|
20
20
|
Exclude:
|
21
21
|
- 'test/dummy/db/migrate/*'
|
22
22
|
|
23
|
+
# Not a useful metric compared to, e.g. `AbcSize`.
|
24
|
+
Metrics/ClassLength:
|
25
|
+
Enabled: false
|
26
|
+
|
23
27
|
# The Ruby Style Guide recommends to "Limit lines to 80 characters."
|
24
28
|
# (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
|
25
29
|
# but 100 is also reasonable.
|
@@ -32,6 +36,10 @@ Metrics/LineLength:
|
|
32
36
|
Metrics/MethodLength:
|
33
37
|
Enabled: false
|
34
38
|
|
39
|
+
# Not a useful metric compared to, e.g. `AbcSize`.
|
40
|
+
Metrics/ModuleLength:
|
41
|
+
Enabled: false
|
42
|
+
|
35
43
|
Style/AlignParameters:
|
36
44
|
EnforcedStyle: with_fixed_indentation
|
37
45
|
|
data/.rubocop_todo.yml
CHANGED
@@ -4,17 +4,9 @@
|
|
4
4
|
Metrics/AbcSize:
|
5
5
|
Max: 30 # Goal: 15
|
6
6
|
|
7
|
-
Metrics/ClassLength:
|
8
|
-
Max: 327
|
9
|
-
Exclude:
|
10
|
-
- test/**/*
|
11
|
-
|
12
7
|
Metrics/CyclomaticComplexity:
|
13
8
|
Max: 8 # Goal: 6
|
14
9
|
|
15
|
-
Metrics/ModuleLength:
|
16
|
-
Max: 317
|
17
|
-
|
18
10
|
Metrics/PerceivedComplexity:
|
19
11
|
Max: 10 # Goal: 7
|
20
12
|
|
data/.travis.yml
CHANGED
@@ -25,17 +25,19 @@ before_script:
|
|
25
25
|
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_foo;' -U postgres; fi"
|
26
26
|
|
27
27
|
gemfile:
|
28
|
-
- gemfiles/
|
29
|
-
- gemfiles/
|
30
|
-
- gemfiles/
|
28
|
+
- gemfiles/ar_4.2.gemfile
|
29
|
+
- gemfiles/ar_5.0.gemfile
|
30
|
+
- gemfiles/ar_master.gemfile
|
31
31
|
|
32
32
|
matrix:
|
33
33
|
fast_finish: true
|
34
34
|
exclude:
|
35
|
-
- gemfile: gemfiles/
|
35
|
+
- gemfile: gemfiles/ar_5.0.gemfile
|
36
36
|
rvm: 1.9.3
|
37
|
-
- gemfile: gemfiles/
|
37
|
+
- gemfile: gemfiles/ar_5.0.gemfile
|
38
38
|
rvm: jruby-19mode
|
39
|
+
allow_failures:
|
40
|
+
- gemfile: gemfiles/ar_master.gemfile
|
39
41
|
|
40
42
|
addons:
|
41
43
|
postgresql: "9.4"
|
data/Appraisals
CHANGED
@@ -7,27 +7,12 @@
|
|
7
7
|
# > the version from the appraisal takes precedence.
|
8
8
|
# > https://github.com/thoughtbot/appraisal
|
9
9
|
|
10
|
-
appraise "
|
11
|
-
gem "activerecord", "~> 3.2.22"
|
12
|
-
gem "i18n", "~> 0.6.11"
|
13
|
-
gem "request_store", "~> 1.1.0"
|
14
|
-
gem "sinatra", "~> 1.4.6"
|
15
|
-
|
16
|
-
group :development, :test do
|
17
|
-
gem 'railties', '~> 3.2.22'
|
18
|
-
gem 'test-unit', '~> 3.1.5'
|
19
|
-
platforms :ruby do
|
20
|
-
gem 'mysql2', '~> 0.3.20'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
appraise "ar4" do
|
10
|
+
appraise "ar-4.2" do
|
26
11
|
gem "activerecord", "~> 4.2"
|
27
12
|
gem "sinatra", "~> 1.4.6"
|
28
13
|
end
|
29
14
|
|
30
|
-
appraise "
|
15
|
+
appraise "ar-5.0" do
|
31
16
|
gem "activerecord", "~> 5.0.0"
|
32
17
|
gem "rspec-rails", "~> 3.5.1"
|
33
18
|
gem 'rails-controller-testing'
|
@@ -36,3 +21,9 @@ appraise "ar5" do
|
|
36
21
|
# Contributions welcome.
|
37
22
|
# gem "sinatra", "2.0.0.beta2"
|
38
23
|
end
|
24
|
+
|
25
|
+
appraise "ar_master" do
|
26
|
+
gem "rails", github: "rails/rails"
|
27
|
+
gem "rspec-rails", "~> 3.5.1"
|
28
|
+
gem "rails-controller-testing"
|
29
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,51 @@
|
|
3
3
|
This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the
|
4
4
|
recommendations of [keepachangelog.com](http://keepachangelog.com/).
|
5
5
|
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
### Breaking Changes
|
9
|
+
|
10
|
+
- None
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- None
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
- None
|
19
|
+
|
20
|
+
## 6.0.0 (2016-12-03)
|
21
|
+
|
22
|
+
Now with rails 5.1 support, and less model pollution! About 40 methods that were
|
23
|
+
polluting your models' namespaces have been removed, reducing the chances of a
|
24
|
+
name conflict with your methods.
|
25
|
+
|
26
|
+
### Breaking Changes
|
27
|
+
|
28
|
+
- [#898](https://github.com/airblade/paper_trail/pull/898) - Dropped support
|
29
|
+
for rails 3
|
30
|
+
- [#864](https://github.com/airblade/paper_trail/pull/864) - The model methods
|
31
|
+
deprecated in 5.2.0 have been removed. Use `paper_trail.x` instead of `x`.
|
32
|
+
- [#861](https://github.com/airblade/paper_trail/pull/861) - `timestamp_field=`
|
33
|
+
removed without replacement. It is no longer configurable. The
|
34
|
+
timestamp field in the `versions` table must now be named `created_at`.
|
35
|
+
|
36
|
+
### Deprecated
|
37
|
+
|
38
|
+
- None
|
39
|
+
|
40
|
+
### Added
|
41
|
+
|
42
|
+
- [#900](https://github.com/airblade/paper_trail/pull/900/files) -
|
43
|
+
Support for rails 5.1
|
44
|
+
- [#881](https://github.com/airblade/paper_trail/pull/881) - Add RSpec matcher
|
45
|
+
`have_a_version_with_changes` for easier testing.
|
46
|
+
|
47
|
+
### Fixed
|
48
|
+
|
49
|
+
- None
|
50
|
+
|
6
51
|
## 5.2.3 (2016-11-29)
|
7
52
|
|
8
53
|
### Breaking Changes
|
@@ -24,6 +69,7 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
|
|
24
69
|
- [#868](https://github.com/airblade/paper_trail/pull/868)
|
25
70
|
Fix usage of find_by_id when primary key is not id, affecting reifying certain records.
|
26
71
|
|
72
|
+
|
27
73
|
## 5.2.2 (2016-09-08)
|
28
74
|
|
29
75
|
### Breaking Changes
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ has been destroyed.
|
|
10
10
|
|
11
11
|
| Version | Documentation |
|
12
12
|
| -------------- | ------------- |
|
13
|
-
|
|
13
|
+
| 6.0.0 | https://github.com/airblade/paper_trail/blob/master/README.md |
|
14
14
|
| 5.2.3 | https://github.com/airblade/paper_trail/blob/v5.2.3/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 |
|
@@ -49,20 +49,25 @@ has been destroyed.
|
|
49
49
|
- [6.a. Custom Version Classes](#6a-custom-version-classes)
|
50
50
|
- [6.b. Custom Serializer](#6b-custom-serializer)
|
51
51
|
- [7. Testing](#7-testing)
|
52
|
+
- [7.a Minitest](#7a-minitest)
|
53
|
+
- [7.b RSpec](#7b-rspec)
|
54
|
+
- [7.c Cucumber](#7c-cucumber)
|
55
|
+
- [7.d Spork](#7d-spork)
|
56
|
+
- [7.e Zeus or Spring](#7e-zeus-or-spring)
|
52
57
|
- [8. Sinatra](#8-sinatra)
|
53
58
|
|
54
59
|
## 1. Introduction
|
55
60
|
|
56
61
|
### 1.a. Compatibility
|
57
62
|
|
58
|
-
| paper_trail | branch | tags | ruby | activerecord
|
59
|
-
| -------------- | ---------- | ------ | -------- |
|
60
|
-
| 6
|
61
|
-
| 5 | 5-stable | v5.x | >= 1.9.3 | >= 3.0, <
|
62
|
-
| 4 | 4-stable | v4.x | >= 1.8.7 | >= 3.0, <
|
63
|
-
| 3 | 3.0-stable | v3.x | >= 1.8.7 | >= 3.0, < 5
|
64
|
-
| 2 | 2.7-stable | v2.x | >= 1.8.7 | >= 3.0, < 4
|
65
|
-
| 1 | rails2 | v1.x | >= 1.8.7 | >= 2.3, < 3
|
63
|
+
| paper_trail | branch | tags | ruby | activerecord |
|
64
|
+
| -------------- | ---------- | ------ | -------- | ------------- |
|
65
|
+
| 6 | master | v6.x | >= 1.9.3 | >= 4.0, < 6 |
|
66
|
+
| 5 | 5-stable | v5.x | >= 1.9.3 | >= 3.0, < 5.1 |
|
67
|
+
| 4 | 4-stable | v4.x | >= 1.8.7 | >= 3.0, < 5.1 |
|
68
|
+
| 3 | 3.0-stable | v3.x | >= 1.8.7 | >= 3.0, < 5 |
|
69
|
+
| 2 | 2.7-stable | v2.x | >= 1.8.7 | >= 3.0, < 4 |
|
70
|
+
| 1 | rails2 | v1.x | >= 1.8.7 | >= 2.3, < 3 |
|
66
71
|
|
67
72
|
### 1.b. Installation
|
68
73
|
|
@@ -721,14 +726,12 @@ the `whodunnit` value for an operation inside a block like this:
|
|
721
726
|
|
722
727
|
```ruby
|
723
728
|
PaperTrail.whodunnit = 'Andy Stewart'
|
724
|
-
widget.whodunnit('Lucas Souza') do
|
729
|
+
widget.paper_trail.whodunnit('Lucas Souza') do
|
725
730
|
widget.update_attributes :name => 'Wibble'
|
726
731
|
end
|
727
732
|
widget.versions.last.whodunnit # Lucas Souza
|
728
733
|
widget.update_attributes :name => 'Clair'
|
729
734
|
widget.versions.last.whodunnit # Andy Stewart
|
730
|
-
widget.whodunnit('Ben Atkins') { |w| w.update_attributes :name => 'Beth' } # this syntax also works
|
731
|
-
widget.versions.last.whodunnit # Ben Atkins
|
732
735
|
```
|
733
736
|
|
734
737
|
A version's `whodunnit` records who changed the object causing the `version` to
|
@@ -1061,7 +1064,7 @@ Overriding associations is not recommended in general.
|
|
1061
1064
|
### 5.c. Generators
|
1062
1065
|
|
1063
1066
|
PaperTrail has one generator, `paper_trail:install`. It writes, but does not
|
1064
|
-
run, a migration file. It also creates a PaperTrail configuration
|
1067
|
+
run, a migration file. It also creates a PaperTrail configuration initializer.
|
1065
1068
|
The migration adds (at least) the `versions` table. The
|
1066
1069
|
most up-to-date documentation for this generator can be found by running `rails
|
1067
1070
|
generate paper_trail:install --help`, but a copy is included here for
|
@@ -1386,26 +1389,44 @@ describe Widget do
|
|
1386
1389
|
end
|
1387
1390
|
```
|
1388
1391
|
|
1389
|
-
It is also possible to do assertions on the versions using `have_a_version_with`
|
1390
|
-
matcher
|
1392
|
+
It is also possible to do assertions on the versions using `have_a_version_with` matcher.
|
1391
1393
|
|
1394
|
+
```ruby
|
1395
|
+
describe '`have_a_version_with` matcher' do
|
1396
|
+
before do
|
1397
|
+
widget.update_attributes!(name: 'Leonard', an_integer: 1)
|
1398
|
+
widget.update_attributes!(name: 'Tom')
|
1399
|
+
widget.update_attributes!(name: 'Bob')
|
1400
|
+
end
|
1401
|
+
|
1402
|
+
it "is possible to do assertions on version attributes" do
|
1403
|
+
expect(widget).to have_a_version_with name: 'Leonard', an_integer: 1
|
1404
|
+
expect(widget).to have_a_version_with an_integer: 1
|
1405
|
+
expect(widget).to have_a_version_with name: 'Tom'
|
1406
|
+
end
|
1407
|
+
end
|
1392
1408
|
```
|
1393
|
-
|
1394
|
-
before do
|
1395
|
-
widget.update_attributes!(:name => 'Leonard', :an_integer => 1 )
|
1396
|
-
widget.update_attributes!(:name => 'Tom')
|
1397
|
-
widget.update_attributes!(:name => 'Bob')
|
1398
|
-
end
|
1409
|
+
There is also a `have_a_version_with_changes` matcher. This is only usable if your versions table [has an `object_changes` column for storing changesets](#3c-diffing-versions).
|
1399
1410
|
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1411
|
+
```ruby
|
1412
|
+
describe '`have_a_version_with_changes` matcher' do
|
1413
|
+
before do
|
1414
|
+
widget.update_attributes!(name: 'Leonard', an_integer: 1)
|
1415
|
+
widget.update_attributes!(name: 'Tom')
|
1416
|
+
widget.update_attributes!(name: 'Bob')
|
1405
1417
|
end
|
1406
1418
|
|
1419
|
+
it "is possible to do assertions on version changes" do
|
1420
|
+
expect(widget).to have_a_version_with name: 'Leonard', an_integer: 2
|
1421
|
+
expect(widget).to have_a_version_with an_integer: 2
|
1422
|
+
expect(widget).to have_a_version_with name: 'Bob'
|
1423
|
+
end
|
1424
|
+
end
|
1407
1425
|
```
|
1408
1426
|
|
1427
|
+
For more examples of the RSpec matchers, see the
|
1428
|
+
[Widget spec](https://github.com/airblade/paper_trail/blob/master/spec/models/widget_spec.rb)
|
1429
|
+
|
1409
1430
|
### 7.c. Cucumber
|
1410
1431
|
|
1411
1432
|
PaperTrail provides a helper for [Cucumber][28] that works similar to the RSpec
|
data/doc/triage.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Triage
|
2
|
+
|
3
|
+
## Response to Usage Question
|
4
|
+
|
5
|
+
```
|
6
|
+
Per our [contributing guide][1], please ask usage questions on [StackOverflow][2].
|
7
|
+
|
8
|
+
Due to limited volunteer time, we can only accept bug reports and feature requests here on GitHub.
|
9
|
+
|
10
|
+
Once you create a question on StackOverflow, please feel free to comment here with the URL.
|
11
|
+
|
12
|
+
For instructions on how to file a bug report, please see our [issue template][3].
|
13
|
+
|
14
|
+
[1]: https://github.com/airblade/paper_trail/blob/master/.github/CONTRIBUTING.md
|
15
|
+
[2]: https://stackoverflow.com/tags/paper-trail-gem
|
16
|
+
[3]: https://github.com/airblade/paper_trail/blob/master/.github/ISSUE_TEMPLATE.md
|
17
|
+
```
|
18
|
+
|
19
|
+
## Responses to Common Problems
|
20
|
+
|
21
|
+
```
|
22
|
+
Thanks for the bug report. Per our [contributing guide][1] please use
|
23
|
+
our [bug report template][2].
|
24
|
+
|
25
|
+
[1]: https://github.com/airblade/paper_trail/blob/master/.github/CONTRIBUTING.md
|
26
|
+
[2]: https://github.com/airblade/paper_trail/blob/master/doc/bug_report_template.rb
|
27
|
+
```
|
File without changes
|
File without changes
|
data/lib/paper_trail/cleaner.rb
CHANGED
data/lib/paper_trail/config.rb
CHANGED
@@ -7,7 +7,6 @@ module PaperTrail
|
|
7
7
|
class Config
|
8
8
|
include Singleton
|
9
9
|
attr_accessor :serializer, :version_limit
|
10
|
-
attr_reader :timestamp_field # deprecated
|
11
10
|
attr_writer :track_associations
|
12
11
|
|
13
12
|
def initialize
|
@@ -16,7 +15,6 @@ module PaperTrail
|
|
16
15
|
@enabled = true
|
17
16
|
|
18
17
|
# Variables which affect all threads, whose access is *not* synchronized.
|
19
|
-
@timestamp_field = :created_at
|
20
18
|
@serializer = PaperTrail::Serializers::YAML
|
21
19
|
end
|
22
20
|
|
@@ -35,18 +33,6 @@ module PaperTrail
|
|
35
33
|
)
|
36
34
|
end
|
37
35
|
|
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
|
-
|
50
36
|
# Previously, we checked `PaperTrail::VersionAssociation.table_exists?`
|
51
37
|
# here, but that proved to be problematic in situations when the database
|
52
38
|
# connection had not been established, or when the database does not exist
|
@@ -54,7 +40,7 @@ module PaperTrail
|
|
54
40
|
def track_associations?
|
55
41
|
if @track_associations.nil?
|
56
42
|
ActiveSupport::Deprecation.warn <<-EOS.strip_heredoc.gsub(/\s+/, " ")
|
57
|
-
PaperTrail.track_associations has not been set. As of PaperTrail 5, it
|
43
|
+
PaperTrail.config.track_associations has not been set. As of PaperTrail 5, it
|
58
44
|
defaults to false. Tracking associations is an experimental feature so
|
59
45
|
we recommend setting PaperTrail.config.track_associations = false in
|
60
46
|
your config/initializers/paper_trail.rb
|