paper_trail 4.0.0 → 5.1.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 +105 -0
- data/.github/ISSUE_TEMPLATE.md +13 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +100 -0
- data/.rubocop_todo.yml +14 -0
- data/.travis.yml +11 -10
- data/Appraisals +37 -0
- data/CHANGELOG.md +173 -8
- data/Gemfile +1 -1
- data/README.md +641 -470
- data/Rakefile +19 -19
- data/doc/bug_report_template.rb +71 -0
- data/doc/warning_about_not_setting_whodunnit.md +32 -0
- data/gemfiles/ar3.gemfile +18 -0
- data/gemfiles/ar4.gemfile +7 -0
- data/gemfiles/ar5.gemfile +13 -0
- data/lib/generators/paper_trail/install_generator.rb +26 -18
- data/lib/generators/paper_trail/templates/add_object_changes_to_versions.rb +3 -1
- data/lib/generators/paper_trail/templates/add_transaction_id_column_to_versions.rb +2 -0
- data/lib/generators/paper_trail/templates/create_version_associations.rb +9 -4
- data/lib/generators/paper_trail/templates/create_versions.rb +53 -5
- data/lib/paper_trail/attribute_serializers/README.md +10 -0
- data/lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb +58 -0
- data/lib/paper_trail/attribute_serializers/legacy_active_record_shim.rb +48 -0
- data/lib/paper_trail/attribute_serializers/object_attribute.rb +39 -0
- data/lib/paper_trail/attribute_serializers/object_changes_attribute.rb +42 -0
- data/lib/paper_trail/cleaner.rb +41 -18
- data/lib/paper_trail/config.rb +42 -26
- data/lib/paper_trail/frameworks/active_record/models/paper_trail/version.rb +5 -1
- data/lib/paper_trail/frameworks/active_record/models/paper_trail/version_association.rb +6 -2
- data/lib/paper_trail/frameworks/active_record.rb +2 -2
- data/lib/paper_trail/frameworks/cucumber.rb +1 -0
- data/lib/paper_trail/frameworks/rails/controller.rb +50 -14
- data/lib/paper_trail/frameworks/rails/engine.rb +6 -1
- data/lib/paper_trail/frameworks/rails.rb +2 -7
- data/lib/paper_trail/frameworks/rspec/helpers.rb +3 -1
- data/lib/paper_trail/frameworks/rspec.rb +5 -5
- data/lib/paper_trail/frameworks/sinatra.rb +8 -5
- data/lib/paper_trail/has_paper_trail.rb +381 -221
- data/lib/paper_trail/record_history.rb +57 -0
- data/lib/paper_trail/reifier.rb +450 -0
- data/lib/paper_trail/serializers/json.rb +7 -7
- data/lib/paper_trail/serializers/yaml.rb +31 -12
- data/lib/paper_trail/version_association_concern.rb +6 -2
- data/lib/paper_trail/version_concern.rb +200 -287
- data/lib/paper_trail/version_number.rb +6 -9
- data/lib/paper_trail.rb +169 -137
- data/paper_trail.gemspec +41 -43
- data/spec/generators/install_generator_spec.rb +24 -25
- data/spec/generators/paper_trail/templates/create_versions_spec.rb +51 -0
- data/spec/models/animal_spec.rb +23 -6
- data/spec/models/boolit_spec.rb +8 -8
- data/spec/models/callback_modifier_spec.rb +96 -0
- data/spec/models/car_spec.rb +13 -0
- data/spec/models/fluxor_spec.rb +3 -3
- data/spec/models/gadget_spec.rb +19 -19
- data/spec/models/joined_version_spec.rb +3 -3
- data/spec/models/json_version_spec.rb +50 -28
- data/spec/models/kitchen/banana_spec.rb +3 -3
- data/spec/models/not_on_update_spec.rb +7 -4
- data/spec/models/post_with_status_spec.rb +13 -3
- data/spec/models/skipper_spec.rb +40 -11
- data/spec/models/thing_spec.rb +4 -4
- data/spec/models/truck_spec.rb +5 -0
- data/spec/models/vehicle_spec.rb +5 -0
- data/spec/models/version_spec.rb +103 -59
- data/spec/models/widget_spec.rb +86 -55
- data/spec/modules/paper_trail_spec.rb +2 -2
- data/spec/modules/version_concern_spec.rb +11 -12
- data/spec/modules/version_number_spec.rb +3 -4
- data/spec/paper_trail/config_spec.rb +33 -0
- data/spec/paper_trail_spec.rb +16 -14
- data/spec/rails_helper.rb +10 -9
- data/spec/requests/articles_spec.rb +11 -7
- data/spec/spec_helper.rb +42 -17
- data/spec/support/alt_db_init.rb +8 -13
- data/test/custom_json_serializer.rb +3 -3
- data/test/dummy/Rakefile +2 -2
- data/test/dummy/app/controllers/application_controller.rb +21 -8
- data/test/dummy/app/controllers/articles_controller.rb +11 -8
- data/test/dummy/app/controllers/widgets_controller.rb +13 -12
- data/test/dummy/app/models/animal.rb +1 -1
- data/test/dummy/app/models/article.rb +19 -11
- data/test/dummy/app/models/authorship.rb +1 -1
- data/test/dummy/app/models/bar_habtm.rb +4 -0
- data/test/dummy/app/models/book.rb +4 -4
- data/test/dummy/app/models/boolit.rb +1 -1
- data/test/dummy/app/models/callback_modifier.rb +45 -0
- data/test/dummy/app/models/car.rb +3 -0
- data/test/dummy/app/models/chapter.rb +9 -0
- data/test/dummy/app/models/citation.rb +5 -0
- data/test/dummy/app/models/customer.rb +1 -1
- data/test/dummy/app/models/document.rb +2 -2
- data/test/dummy/app/models/editor.rb +1 -1
- data/test/dummy/app/models/foo_habtm.rb +5 -0
- data/test/dummy/app/models/fruit.rb +2 -2
- data/test/dummy/app/models/gadget.rb +1 -1
- data/test/dummy/app/models/kitchen/banana.rb +1 -1
- data/test/dummy/app/models/legacy_widget.rb +2 -2
- data/test/dummy/app/models/line_item.rb +1 -1
- data/test/dummy/app/models/not_on_update.rb +1 -1
- data/test/dummy/app/models/paragraph.rb +5 -0
- data/test/dummy/app/models/person.rb +6 -6
- data/test/dummy/app/models/post.rb +1 -1
- data/test/dummy/app/models/post_with_status.rb +1 -1
- data/test/dummy/app/models/quotation.rb +5 -0
- data/test/dummy/app/models/section.rb +6 -0
- data/test/dummy/app/models/skipper.rb +2 -2
- data/test/dummy/app/models/song.rb +13 -4
- data/test/dummy/app/models/thing.rb +2 -2
- data/test/dummy/app/models/translation.rb +2 -2
- data/test/dummy/app/models/truck.rb +4 -0
- data/test/dummy/app/models/vehicle.rb +4 -0
- data/test/dummy/app/models/whatchamajigger.rb +1 -1
- data/test/dummy/app/models/widget.rb +7 -6
- data/test/dummy/app/versions/joined_version.rb +4 -3
- data/test/dummy/app/versions/json_version.rb +1 -1
- data/test/dummy/app/versions/kitchen/banana_version.rb +1 -1
- data/test/dummy/app/versions/post_version.rb +2 -2
- data/test/dummy/config/application.rb +20 -9
- data/test/dummy/config/boot.rb +5 -5
- data/test/dummy/config/database.postgres.yml +1 -1
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +4 -3
- data/test/dummy/config/environments/production.rb +3 -2
- data/test/dummy/config/environments/test.rb +15 -5
- data/test/dummy/config/initializers/backtrace_silencers.rb +4 -2
- data/test/dummy/config/initializers/paper_trail.rb +4 -3
- data/test/dummy/config/initializers/secret_token.rb +3 -1
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/routes.rb +2 -2
- data/test/dummy/config.ru +1 -1
- data/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +148 -68
- data/test/dummy/db/schema.rb +119 -31
- data/test/dummy/script/rails +6 -4
- data/test/functional/controller_test.rb +34 -35
- data/test/functional/enabled_for_controller_test.rb +6 -7
- data/test/functional/modular_sinatra_test.rb +43 -38
- data/test/functional/sinatra_test.rb +49 -40
- data/test/functional/thread_safety_test.rb +4 -6
- data/test/paper_trail_test.rb +15 -14
- data/test/test_helper.rb +78 -18
- data/test/time_travel_helper.rb +1 -15
- data/test/unit/associations_test.rb +1016 -0
- data/test/unit/cleaner_test.rb +66 -60
- data/test/unit/inheritance_column_test.rb +19 -19
- data/test/unit/model_test.rb +646 -1071
- data/test/unit/protected_attrs_test.rb +19 -14
- data/test/unit/serializer_test.rb +44 -43
- data/test/unit/serializers/json_test.rb +28 -21
- data/test/unit/serializers/mixin_json_test.rb +15 -14
- data/test/unit/serializers/mixin_yaml_test.rb +20 -16
- data/test/unit/serializers/yaml_test.rb +16 -14
- data/test/unit/timestamp_test.rb +10 -12
- data/test/unit/version_test.rb +88 -70
- metadata +166 -72
- data/gemfiles/3.0.gemfile +0 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83f408e34bbaf733c5fdab5ad37fc8c3718ab7ad
|
|
4
|
+
data.tar.gz: b1e73feb664e29d18946f3c526b1bb6b1ccec024
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b61edd25675bb0ea5254640920f04ff23aab1fc9dc729bc2bb27c5f4bd6774fb6e86df50d213d173a2892e7b2ef2e15240745e541d9f4fb0238c4b07574f6e56
|
|
7
|
+
data.tar.gz: 8b701f3921a8945fd3e7e55dbda82c7b716711e457f72caf7054dd502fd77a927ef5c5ebcf7d634f9c8465ba0bc8c44cc057220bea24cbaac1f5dbad7f2c9a96
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in PaperTrail!
|
|
4
|
+
|
|
5
|
+
Ask usage questions on Stack Overflow:
|
|
6
|
+
https://stackoverflow.com/tags/paper-trail-gem
|
|
7
|
+
|
|
8
|
+
**Please do not use github issues to ask usage questions.**
|
|
9
|
+
|
|
10
|
+
On github, we appreciate bug reports, feature
|
|
11
|
+
suggestions, and especially pull requests.
|
|
12
|
+
|
|
13
|
+
Thanks, and happy (paper) trails :)
|
|
14
|
+
|
|
15
|
+
## Reporting Bugs
|
|
16
|
+
|
|
17
|
+
Please use our [bug report template][1].
|
|
18
|
+
|
|
19
|
+
## Development
|
|
20
|
+
|
|
21
|
+
Testing is a little awkward because the test suite:
|
|
22
|
+
|
|
23
|
+
1. Supports three major versions of rails: 3, 4, 5
|
|
24
|
+
1. Contains a "dummy" rails app with three databases (test, foo, and bar)
|
|
25
|
+
1. Supports three different RDBMS': sqlite, mysql, and postgres
|
|
26
|
+
|
|
27
|
+
Test against rails 3:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
bundle exec appraisal ar3 rake
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Run tests with sqlite:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
# Create the appropriate database config. file
|
|
37
|
+
rm test/dummy/config/database.yml
|
|
38
|
+
DB=sqlite bundle exec rake prepare
|
|
39
|
+
|
|
40
|
+
# If this is the first test run ever, create databases
|
|
41
|
+
cd test/dummy
|
|
42
|
+
RAILS_ENV=test bundle exec rake db:setup
|
|
43
|
+
RAILS_ENV=foo bundle exec rake db:setup
|
|
44
|
+
RAILS_ENV=bar bundle exec rake db:setup
|
|
45
|
+
cd ../..
|
|
46
|
+
|
|
47
|
+
# Run tests
|
|
48
|
+
DB=sqlite bundle exec rake
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Run tests with mysql:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
# Create the appropriate database config. file
|
|
55
|
+
rm test/dummy/config/database.yml
|
|
56
|
+
DB=mysql bundle exec rake prepare
|
|
57
|
+
|
|
58
|
+
# If this is the first test run ever, create databases
|
|
59
|
+
cd test/dummy
|
|
60
|
+
RAILS_ENV=test bundle exec rake db:setup
|
|
61
|
+
RAILS_ENV=foo bundle exec rake db:setup
|
|
62
|
+
RAILS_ENV=bar bundle exec rake db:setup
|
|
63
|
+
cd ../..
|
|
64
|
+
|
|
65
|
+
# Run tests
|
|
66
|
+
DB=mysql bundle exec rake
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Run tests with postgres:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
# Create the appropriate database config. file
|
|
73
|
+
rm test/dummy/config/database.yml
|
|
74
|
+
DB=postgres bundle exec rake prepare
|
|
75
|
+
|
|
76
|
+
# If this is the first test run ever, create databases.
|
|
77
|
+
# Unlike mysql, use create/migrate instead of setup.
|
|
78
|
+
cd test/dummy
|
|
79
|
+
DB=postgres RAILS_ENV=test bundle exec rake db:create
|
|
80
|
+
DB=postgres RAILS_ENV=test bundle exec rake db:migrate
|
|
81
|
+
DB=postgres RAILS_ENV=foo bundle exec rake db:create
|
|
82
|
+
DB=postgres RAILS_ENV=foo bundle exec rake db:migrate
|
|
83
|
+
DB=postgres RAILS_ENV=bar bundle exec rake db:create
|
|
84
|
+
DB=postgres RAILS_ENV=bar bundle exec rake db:migrate
|
|
85
|
+
cd ../..
|
|
86
|
+
|
|
87
|
+
# Run tests
|
|
88
|
+
DB=postgres bundle exec rake
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Releases
|
|
92
|
+
|
|
93
|
+
1. Set the version in lib/paper_trail/version_number.rb
|
|
94
|
+
- Set PRE to nil unless it's a pre-release (beta, rc, etc.)
|
|
95
|
+
1. In the changelog, replace "Unreleased" with the date.
|
|
96
|
+
1. In the readme,
|
|
97
|
+
- remove "unreleased" from the doc versions table
|
|
98
|
+
- update any other references to version number
|
|
99
|
+
1. Commit
|
|
100
|
+
1. Tag with `git tag -a -m "v5.0.0" "v5.0.0"`
|
|
101
|
+
1. `git push --tags origin master`
|
|
102
|
+
1. `gem build paper_trail.gemspec`
|
|
103
|
+
1. `gem push paper_trail-5.0.0.gem`
|
|
104
|
+
|
|
105
|
+
[1]: https://github.com/airblade/paper_trail/blob/master/doc/bug_report_template.rb
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Thanks for your interest in PaperTrail! Our volunteers' time is limited, so we
|
|
2
|
+
can only respond on GitHub to bug reports and feature requests. Please ask
|
|
3
|
+
*usage questions* on StackOverflow (https://stackoverflow.com/tags/paper-trail-gem)
|
|
4
|
+
so that the whole community has a chance to answer your question.
|
|
5
|
+
|
|
6
|
+
Please use our template
|
|
7
|
+
(https://github.com/airblade/paper_trail/blob/master/doc/bug_report_template.rb)
|
|
8
|
+
when reporting bugs.
|
|
9
|
+
|
|
10
|
+
For other questions, please see our contributing guide.
|
|
11
|
+
(https://github.com/airblade/paper_trail/blob/master/.github/CONTRIBUTING.md)
|
|
12
|
+
|
|
13
|
+
Thanks for your contribution!
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
|
2
|
+
|
|
3
|
+
# Please:
|
|
4
|
+
#
|
|
5
|
+
# - Comment any deviations from the Ruby Style Guide
|
|
6
|
+
# - Alphabetize cops
|
|
7
|
+
# - Only include permanent config; temporary goes in .rubocop_todo.yml
|
|
8
|
+
|
|
9
|
+
# We do not control `schema.rb`. Exclude it from all cops.
|
|
10
|
+
AllCops:
|
|
11
|
+
Exclude:
|
|
12
|
+
- test/dummy/db/schema.rb
|
|
13
|
+
|
|
14
|
+
# Migrations often contain long up/down methods, and extracting smaller methods
|
|
15
|
+
# from these is of questionable value.
|
|
16
|
+
Metrics/AbcSize:
|
|
17
|
+
Exclude:
|
|
18
|
+
- 'test/dummy/db/migrate/*'
|
|
19
|
+
|
|
20
|
+
Metrics/ClassLength:
|
|
21
|
+
Exclude:
|
|
22
|
+
- test/**/*
|
|
23
|
+
|
|
24
|
+
# The Ruby Style Guide recommends to "Limit lines to 80 characters."
|
|
25
|
+
# (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
|
|
26
|
+
# but 100 is also reasonable.
|
|
27
|
+
Metrics/LineLength:
|
|
28
|
+
Max: 100
|
|
29
|
+
|
|
30
|
+
# The number of lines in a method is not a useful metric compared to `AbcSize`.
|
|
31
|
+
# It's common to have very long methods (> 50 lines) which are quite simple. For
|
|
32
|
+
# example, a method that returns a long string with only a few interpolations.
|
|
33
|
+
Metrics/MethodLength:
|
|
34
|
+
Enabled: false
|
|
35
|
+
|
|
36
|
+
Style/AlignParameters:
|
|
37
|
+
EnforcedStyle: with_fixed_indentation
|
|
38
|
+
|
|
39
|
+
# Please use semantic style, e.g. `do` when there's a side-effect, else `{}`.
|
|
40
|
+
# The semantic style is too nuanced to lint, so the cop is disabled.
|
|
41
|
+
Style/BlockDelimiters:
|
|
42
|
+
Enabled: false
|
|
43
|
+
|
|
44
|
+
Style/DotPosition:
|
|
45
|
+
EnforcedStyle: trailing
|
|
46
|
+
|
|
47
|
+
# Use double negation wherever it would otherwise be impractical to convert
|
|
48
|
+
# a value to an actual boolean.
|
|
49
|
+
Style/DoubleNegation:
|
|
50
|
+
Enabled: false
|
|
51
|
+
|
|
52
|
+
# The decision of when to use a guard clause to improve readability is subtle,
|
|
53
|
+
# and it's not clear that it can be linted. Certainly, the default
|
|
54
|
+
# `MinBodyLength` of 1 can actually hurt readability.
|
|
55
|
+
Style/GuardClause:
|
|
56
|
+
MinBodyLength: 3
|
|
57
|
+
|
|
58
|
+
# Use postfix (modifier) conditionals for one-liners, unless doing so would
|
|
59
|
+
# exceed 60 characters.
|
|
60
|
+
Style/IfUnlessModifier:
|
|
61
|
+
MaxLineLength: 60
|
|
62
|
+
|
|
63
|
+
# The Ruby Style Guide says:
|
|
64
|
+
#
|
|
65
|
+
# > Use \ instead of + or << to concatenate two string literals at line end.
|
|
66
|
+
#
|
|
67
|
+
# but in my experience the `\` style is rarely used and less readable. Please
|
|
68
|
+
# concatenate multiline strings with `+` or use a HEREDOC.
|
|
69
|
+
Style/LineEndConcatenation:
|
|
70
|
+
Enabled: false
|
|
71
|
+
|
|
72
|
+
# Using `module_function` instead of `extend self` would make the instance
|
|
73
|
+
# methods in these modules private. That would be a breaking change, so these
|
|
74
|
+
# modules are excluded. See discussion in:
|
|
75
|
+
# - https://github.com/airblade/paper_trail/pull/756
|
|
76
|
+
# - https://github.com/bbatsov/ruby-style-guide/issues/556
|
|
77
|
+
Style/ModuleFunction:
|
|
78
|
+
Exclude:
|
|
79
|
+
- 'lib/paper_trail/serializers/json.rb'
|
|
80
|
+
- 'lib/paper_trail/serializers/yaml.rb'
|
|
81
|
+
|
|
82
|
+
Style/MultilineMethodCallIndentation:
|
|
83
|
+
EnforcedStyle: indented
|
|
84
|
+
|
|
85
|
+
Style/MultilineOperationIndentation:
|
|
86
|
+
EnforcedStyle: indented
|
|
87
|
+
|
|
88
|
+
Style/PredicateName:
|
|
89
|
+
NameWhitelist: has_paper_trail
|
|
90
|
+
|
|
91
|
+
# The Ruby Style Guide does not prescribe a particular quote character, only
|
|
92
|
+
# that a project should pick one and be consistent. The decision has no
|
|
93
|
+
# performance implications. Double quotes are slightly easier to read.
|
|
94
|
+
Style/StringLiterals:
|
|
95
|
+
EnforcedStyle: double_quotes
|
|
96
|
+
|
|
97
|
+
# Use exactly one space on each side of an operator. Do not align operators
|
|
98
|
+
# because it makes the code harder to edit, and makes lines unnecessarily long.
|
|
99
|
+
Style/SpaceAroundOperators:
|
|
100
|
+
AllowForAlignment: false
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Remove these configuration records
|
|
2
|
+
# one by one as the offenses are removed from the code base.
|
|
3
|
+
|
|
4
|
+
Metrics/AbcSize:
|
|
5
|
+
Max: 30 # Goal: 15
|
|
6
|
+
|
|
7
|
+
Metrics/CyclomaticComplexity:
|
|
8
|
+
Max: 13 # Goal: 6
|
|
9
|
+
|
|
10
|
+
Metrics/ModuleLength:
|
|
11
|
+
Max: 313
|
|
12
|
+
|
|
13
|
+
Metrics/PerceivedComplexity:
|
|
14
|
+
Max: 16 # Goal: 7
|
data/.travis.yml
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
rvm:
|
|
3
|
-
- 2.
|
|
3
|
+
- 2.3.0
|
|
4
4
|
- 1.9.3
|
|
5
|
-
- 1.8.7
|
|
6
5
|
- jruby-19mode
|
|
7
|
-
- jruby-18mode
|
|
8
6
|
env:
|
|
9
7
|
global:
|
|
10
8
|
- TRAVIS=true
|
|
@@ -16,24 +14,27 @@ env:
|
|
|
16
14
|
sudo: false
|
|
17
15
|
|
|
18
16
|
before_script:
|
|
17
|
+
- mysql --version
|
|
19
18
|
- sh -c "if [ \"$DB\" = 'mysql' ]; then mysql -e 'create database paper_trail_test;'; fi"
|
|
20
19
|
- sh -c "if [ \"$DB\" = 'mysql' ]; then mysql -e 'create database paper_trail_bar; '; fi"
|
|
21
20
|
- sh -c "if [ \"$DB\" = 'mysql' ]; then mysql -e 'create database paper_trail_foo; '; fi"
|
|
21
|
+
- psql --version
|
|
22
22
|
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_test;' -U postgres; fi"
|
|
23
23
|
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_bar;' -U postgres; fi"
|
|
24
24
|
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_foo;' -U postgres; fi"
|
|
25
25
|
|
|
26
26
|
gemfile:
|
|
27
|
-
-
|
|
28
|
-
- gemfiles/
|
|
27
|
+
- gemfiles/ar3.gemfile
|
|
28
|
+
- gemfiles/ar4.gemfile
|
|
29
|
+
- gemfiles/ar5.gemfile
|
|
29
30
|
|
|
30
31
|
matrix:
|
|
31
32
|
fast_finish: true
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
33
|
+
exclude:
|
|
34
|
+
- gemfile: gemfiles/ar5.gemfile
|
|
35
|
+
rvm: 1.9.3
|
|
36
|
+
- gemfile: gemfiles/ar5.gemfile
|
|
37
|
+
rvm: jruby-19mode
|
|
37
38
|
|
|
38
39
|
addons:
|
|
39
40
|
postgresql: "9.4"
|
data/Appraisals
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Specify here only version constraints that differ from
|
|
2
|
+
# `paper_trail.gemspec`.
|
|
3
|
+
#
|
|
4
|
+
# > The dependencies in your Appraisals file are combined with dependencies in
|
|
5
|
+
# > your Gemfile, so you don't need to repeat anything that's the same for each
|
|
6
|
+
# > appraisal. If something is specified in both the Gemfile and an appraisal,
|
|
7
|
+
# > the version from the appraisal takes precedence.
|
|
8
|
+
# > https://github.com/thoughtbot/appraisal
|
|
9
|
+
|
|
10
|
+
appraise "ar3" do
|
|
11
|
+
gem "activerecord", "~> 3.2.22"
|
|
12
|
+
gem "i18n", "~> 0.6.11"
|
|
13
|
+
gem "request_store", "~> 1.1.0"
|
|
14
|
+
|
|
15
|
+
group :development, :test do
|
|
16
|
+
gem 'railties', '~> 3.2.22'
|
|
17
|
+
gem 'test-unit', '~> 3.1.5'
|
|
18
|
+
platforms :ruby do
|
|
19
|
+
gem 'mysql2', '~> 0.3.20'
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
appraise "ar4" do
|
|
25
|
+
gem "activerecord", "~> 4.2"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
appraise "ar5" do
|
|
29
|
+
gem "activerecord", "5.0.0.beta3"
|
|
30
|
+
gem "activemodel", "5.0.0.beta3"
|
|
31
|
+
gem "actionpack", "5.0.0.beta3"
|
|
32
|
+
gem "railties", "5.0.0.beta3"
|
|
33
|
+
gem "rspec-rails", "3.5.0.beta3"
|
|
34
|
+
gem 'rails-controller-testing'
|
|
35
|
+
# Sinatra stable conflicts with AR5's rack dependency
|
|
36
|
+
gem 'sinatra', github: 'sinatra/sinatra'
|
|
37
|
+
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,169 @@
|
|
|
1
|
-
##
|
|
1
|
+
## 5.?.? (Unreleased)
|
|
2
|
+
|
|
3
|
+
### Breaking Changes
|
|
4
|
+
|
|
5
|
+
- None
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- None
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- None
|
|
14
|
+
|
|
15
|
+
## 5.1.0 (2016-05-20)
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
- None
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- [#809](https://github.com/airblade/paper_trail/pull/809) -
|
|
24
|
+
Print warning if version cannot be saved.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- [#812](https://github.com/airblade/paper_trail/pull/812) -
|
|
29
|
+
Issue with saving HABTM associated objects using accepts_nested_attributes_for
|
|
30
|
+
- [#811](https://github.com/airblade/paper_trail/pull/811) -
|
|
31
|
+
Avoid unnecessary query in #record_destroy
|
|
32
|
+
- Improvements to documentation
|
|
33
|
+
|
|
34
|
+
## 5.0.1 (2016-05-04)
|
|
35
|
+
|
|
36
|
+
### Breaking Changes
|
|
37
|
+
|
|
38
|
+
- None
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- None
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- [#791](https://github.com/airblade/paper_trail/issues/791) -
|
|
47
|
+
A rare issue in applications that override `warn`.
|
|
48
|
+
- [#789](https://github.com/airblade/paper_trail/issues/789) -
|
|
49
|
+
A potentially common issue, in applications with initializers that use
|
|
50
|
+
versioned models.
|
|
51
|
+
|
|
52
|
+
## 5.0.0 (2016-05-02)
|
|
53
|
+
|
|
54
|
+
### Breaking Changes
|
|
55
|
+
|
|
56
|
+
- [#758](https://github.com/airblade/paper_trail/pull/758) -
|
|
57
|
+
`PaperTrail.config.track_associations` getter method removed,
|
|
58
|
+
use `track_associations?` instead.
|
|
59
|
+
- [#740](https://github.com/airblade/paper_trail/issues/740) -
|
|
60
|
+
`PaperTrail.config.track_associations?` now defaults to false
|
|
61
|
+
- [#723](https://github.com/airblade/paper_trail/pull/723) -
|
|
62
|
+
`PaperTrail.enabled=` now affects all threads
|
|
63
|
+
- [#556](https://github.com/airblade/paper_trail/pull/556) /
|
|
64
|
+
[#301](https://github.com/airblade/paper_trail/issues/301) -
|
|
65
|
+
If you are tracking who is responsible for changes with `whodunnit`, be aware
|
|
66
|
+
that PaperTrail no longer adds the `set_paper_trail_whodunnit` before_filter
|
|
67
|
+
for you. Please add this before_filter to your ApplicationController to
|
|
68
|
+
continue recording whodunnit. See the readme for an example.
|
|
69
|
+
- [#683](https://github.com/airblade/paper_trail/pull/683) /
|
|
70
|
+
[#682](https://github.com/airblade/paper_trail/issues/682) -
|
|
71
|
+
Destroy callback default changed to :before to accommodate ActiveRecord 5
|
|
72
|
+
option `belongs_to_required_by_default` and new Rails 5 default.
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
- [#771](https://github.com/airblade/paper_trail/pull/771) -
|
|
77
|
+
Added support for has_and_belongs_to_many associations
|
|
78
|
+
- [#741](https://github.com/airblade/paper_trail/issues/741) /
|
|
79
|
+
[#681](https://github.com/airblade/paper_trail/pull/681)
|
|
80
|
+
MySQL unicode support in migration generator
|
|
81
|
+
- [#689](https://github.com/airblade/paper_trail/pull/689) -
|
|
82
|
+
Rails 5 compatibility
|
|
83
|
+
- Added a rails config option: `config.paper_trail.enabled`
|
|
84
|
+
- [#503](https://github.com/airblade/paper_trail/pull/730) -
|
|
85
|
+
Support for reifying belongs_to associations.
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- [#777](https://github.com/airblade/paper_trail/issues/777) -
|
|
90
|
+
Support HMT associations with `:source` option.
|
|
91
|
+
- [#738](https://github.com/airblade/paper_trail/issues/738) -
|
|
92
|
+
Rare bug where a non-versioned STI parent caused `changeset` to
|
|
93
|
+
return an empty hash.
|
|
94
|
+
- [#731](https://github.com/airblade/paper_trail/pull/731) -
|
|
95
|
+
Map enums to database values before storing in `object_changes` column.
|
|
96
|
+
- [#715](https://github.com/airblade/paper_trail/issues/715) -
|
|
97
|
+
Optimize post-rollback association reset.
|
|
98
|
+
- [#701](https://github.com/airblade/paper_trail/pull/701) /
|
|
99
|
+
[#699](https://github.com/airblade/paper_trail/issues/699) -
|
|
100
|
+
Cleaning old versions explicitly preserves the most recent
|
|
101
|
+
versions instead of relying on database result ordering.
|
|
102
|
+
- [#635](https://github.com/airblade/paper_trail/issues/635) -
|
|
103
|
+
A bug where it was not possible to disable PT when using a multi-threaded
|
|
104
|
+
webserver.
|
|
105
|
+
- [#584](https://github.com/airblade/paper_trail/issues/584) -
|
|
106
|
+
Fixed deprecation warning for Active Record after_callback / after_commit
|
|
107
|
+
|
|
108
|
+
## 4.1.0 (2016-01-30)
|
|
109
|
+
|
|
110
|
+
### Breaking Changes
|
|
111
|
+
|
|
112
|
+
- None
|
|
113
|
+
|
|
114
|
+
### Added
|
|
115
|
+
|
|
116
|
+
- A way to control the order of AR callbacks.
|
|
117
|
+
[#614](https://github.com/airblade/paper_trail/pull/614)
|
|
118
|
+
- Added `unversioned_attributes` option to `reify`.
|
|
119
|
+
[#579](https://github.com/airblade/paper_trail/pull/579)
|
|
120
|
+
|
|
121
|
+
### Fixed
|
|
122
|
+
|
|
123
|
+
- None
|
|
124
|
+
|
|
125
|
+
## 4.0.2 (2016-01-19)
|
|
126
|
+
|
|
127
|
+
### Breaking Changes
|
|
128
|
+
|
|
129
|
+
- None
|
|
130
|
+
|
|
131
|
+
### Added
|
|
132
|
+
|
|
133
|
+
- None
|
|
134
|
+
|
|
135
|
+
### Fixed
|
|
136
|
+
|
|
137
|
+
- [#696](https://github.com/airblade/paper_trail/issues/696) /
|
|
138
|
+
[#697](https://github.com/airblade/paper_trail/pull/697)
|
|
139
|
+
Bind JSON query parameters in `where_object` and `where_object_changes`.
|
|
140
|
+
|
|
141
|
+
## 4.0.1 (2015-12-14)
|
|
142
|
+
|
|
143
|
+
### Breaking Changes
|
|
144
|
+
|
|
145
|
+
- None
|
|
146
|
+
|
|
147
|
+
### Added
|
|
148
|
+
|
|
149
|
+
- None
|
|
150
|
+
|
|
151
|
+
### Fixed
|
|
152
|
+
|
|
153
|
+
- [#636](https://github.com/airblade/paper_trail/issues/636) -
|
|
154
|
+
Should compile assets without a db connection
|
|
155
|
+
- [#589](https://github.com/airblade/paper_trail/pull/589) /
|
|
156
|
+
[#588](https://github.com/airblade/paper_trail/issues/588) -
|
|
157
|
+
Fixes timestamp for "create" versions
|
|
158
|
+
|
|
159
|
+
## 4.0.0 (2015-07-30)
|
|
2
160
|
|
|
3
161
|
This major release adds JSON column support in PostgreSQL, limited support for
|
|
4
162
|
versioning associations, various new configuration options, and a year's worth
|
|
5
163
|
of bug fixes. Thanks to everyone who helped test the two betas and two release
|
|
6
164
|
candidates.
|
|
7
165
|
|
|
8
|
-
###
|
|
166
|
+
### Breaking Changes
|
|
9
167
|
|
|
10
168
|
- Using a Rails initializer to reopen PaperTrail::Version or otherwise extend
|
|
11
169
|
PaperTrail is no longer recommended. An alternative is described in the
|
|
@@ -13,6 +171,9 @@ candidates.
|
|
|
13
171
|
https://github.com/airblade/paper_trail/pull/492.
|
|
14
172
|
- If you depend on the `RSpec` or `Cucumber` helpers, you must
|
|
15
173
|
[require them in your test helper](https://github.com/airblade/paper_trail#testing).
|
|
174
|
+
- [#566](https://github.com/airblade/paper_trail/pull/566) - Removed deprecated
|
|
175
|
+
methods `paper_trail_on` and `paper_trail_off`. Use `paper_trail_on!` and
|
|
176
|
+
`paper_trail_off!` instead.
|
|
16
177
|
- [#458](https://github.com/airblade/paper_trail/pull/458) - Version metadata
|
|
17
178
|
(the `:meta` option) from AR attributes for `create` events will now save the
|
|
18
179
|
current value instead of `nil`.
|
|
@@ -29,12 +190,6 @@ candidates.
|
|
|
29
190
|
- `3da1f104` - `PaperTrail.config` and `PaperTrail.configure` are now
|
|
30
191
|
identical: both return the `PaperTrail::Config` instance and also
|
|
31
192
|
yield it if a block is provided.
|
|
32
|
-
|
|
33
|
-
### Removed
|
|
34
|
-
|
|
35
|
-
- [#566](https://github.com/airblade/paper_trail/pull/566) - Removed deprecated
|
|
36
|
-
methods `paper_trail_on` and `paper_trail_off`. Use `paper_trail_on!` and
|
|
37
|
-
`paper_trail_off!` instead.
|
|
38
193
|
|
|
39
194
|
### Added
|
|
40
195
|
|
|
@@ -121,6 +276,16 @@ candidates.
|
|
|
121
276
|
- [#479](https://github.com/airblade/paper_trail/issues/479) - Deprecated
|
|
122
277
|
`originator` method, use `paper_trail_originator`.
|
|
123
278
|
|
|
279
|
+
## 3.0.9
|
|
280
|
+
|
|
281
|
+
- [#479](https://github.com/airblade/paper_trail/issues/479) - Deprecated
|
|
282
|
+
`originator` method in favor of `paper_trail_originator` Deprecation warning
|
|
283
|
+
informs users that the `originator` of the methods will be removed in
|
|
284
|
+
version `4.0`. (Backported from v4)
|
|
285
|
+
- Updated deprecation warnings for `Model.paper_trail_on` and
|
|
286
|
+
`Model.paper_trail_off` to have display correct version number the methods
|
|
287
|
+
will be removed (`4.0`)
|
|
288
|
+
|
|
124
289
|
## 3.0.8
|
|
125
290
|
|
|
126
291
|
- [#525](https://github.com/airblade/paper_trail/issues/525) / [#512](https://github.com/airblade/paper_trail/pull/512) -
|
data/Gemfile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
gemspec
|