paper_trail 4.2.0 → 7.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/paper_trail/install_generator.rb +91 -17
- data/lib/generators/paper_trail/templates/add_object_changes_to_versions.rb.erb +12 -0
- data/lib/generators/paper_trail/templates/{add_transaction_id_column_to_versions.rb → add_transaction_id_column_to_versions.rb.erb} +3 -1
- data/lib/generators/paper_trail/templates/create_version_associations.rb.erb +22 -0
- data/lib/generators/paper_trail/templates/{create_versions.rb → create_versions.rb.erb} +9 -7
- data/lib/paper_trail.rb +180 -148
- data/lib/paper_trail/attribute_serializers/README.md +10 -0
- data/lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb +80 -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 +16 -10
- data/lib/paper_trail/config.rb +28 -27
- 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/cucumber.rb +1 -0
- data/lib/paper_trail/frameworks/rails.rb +2 -7
- data/lib/paper_trail/frameworks/rails/controller.rb +20 -18
- data/lib/paper_trail/frameworks/rails/engine.rb +6 -1
- data/lib/paper_trail/frameworks/rspec.rb +17 -6
- data/lib/paper_trail/frameworks/rspec/helpers.rb +3 -1
- data/lib/paper_trail/has_paper_trail.rb +25 -503
- data/lib/paper_trail/model_config.rb +207 -0
- data/lib/paper_trail/queries/versions/where_object.rb +60 -0
- data/lib/paper_trail/queries/versions/where_object_changes.rb +68 -0
- data/lib/paper_trail/record_history.rb +2 -12
- data/lib/paper_trail/record_trail.rb +573 -0
- data/lib/paper_trail/reifier.rb +164 -215
- data/lib/paper_trail/reifiers/belongs_to.rb +48 -0
- data/lib/paper_trail/reifiers/has_and_belongs_to_many.rb +50 -0
- data/lib/paper_trail/reifiers/has_many.rb +110 -0
- data/lib/paper_trail/reifiers/has_many_through.rb +90 -0
- data/lib/paper_trail/reifiers/has_one.rb +76 -0
- data/lib/paper_trail/serializers/json.rb +16 -7
- data/lib/paper_trail/serializers/yaml.rb +9 -13
- data/lib/paper_trail/version_association_concern.rb +3 -5
- data/lib/paper_trail/version_concern.rb +138 -111
- data/lib/paper_trail/version_number.rb +10 -9
- metadata +95 -327
- data/.gitignore +0 -22
- data/.rspec +0 -2
- data/.travis.yml +0 -41
- data/CHANGELOG.md +0 -362
- data/CONTRIBUTING.md +0 -84
- data/Gemfile +0 -2
- data/MIT-LICENSE +0 -20
- data/README.md +0 -1535
- data/Rakefile +0 -30
- data/doc/bug_report_template.rb +0 -65
- data/gemfiles/ar3.gemfile +0 -61
- data/lib/generators/paper_trail/templates/add_object_changes_to_versions.rb +0 -10
- data/lib/generators/paper_trail/templates/create_version_associations.rb +0 -17
- data/lib/paper_trail/attributes_serialization.rb +0 -89
- data/lib/paper_trail/frameworks/sinatra.rb +0 -38
- data/paper_trail.gemspec +0 -59
- data/spec/generators/install_generator_spec.rb +0 -67
- data/spec/models/animal_spec.rb +0 -36
- data/spec/models/boolit_spec.rb +0 -48
- data/spec/models/callback_modifier_spec.rb +0 -96
- data/spec/models/fluxor_spec.rb +0 -19
- data/spec/models/gadget_spec.rb +0 -70
- data/spec/models/joined_version_spec.rb +0 -47
- data/spec/models/json_version_spec.rb +0 -103
- data/spec/models/kitchen/banana_spec.rb +0 -14
- data/spec/models/not_on_update_spec.rb +0 -19
- data/spec/models/post_with_status_spec.rb +0 -17
- data/spec/models/skipper_spec.rb +0 -46
- data/spec/models/thing_spec.rb +0 -11
- data/spec/models/version_spec.rb +0 -239
- data/spec/models/widget_spec.rb +0 -298
- data/spec/modules/paper_trail_spec.rb +0 -27
- data/spec/modules/version_concern_spec.rb +0 -32
- data/spec/modules/version_number_spec.rb +0 -44
- data/spec/paper_trail/config_spec.rb +0 -52
- data/spec/paper_trail_spec.rb +0 -66
- data/spec/rails_helper.rb +0 -34
- data/spec/requests/articles_spec.rb +0 -30
- data/spec/spec_helper.rb +0 -95
- data/spec/support/alt_db_init.rb +0 -59
- data/test/custom_json_serializer.rb +0 -13
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/controllers/application_controller.rb +0 -20
- data/test/dummy/app/controllers/articles_controller.rb +0 -17
- data/test/dummy/app/controllers/test_controller.rb +0 -5
- data/test/dummy/app/controllers/widgets_controller.rb +0 -31
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/animal.rb +0 -6
- data/test/dummy/app/models/article.rb +0 -16
- data/test/dummy/app/models/authorship.rb +0 -5
- data/test/dummy/app/models/book.rb +0 -9
- data/test/dummy/app/models/boolit.rb +0 -4
- data/test/dummy/app/models/callback_modifier.rb +0 -45
- data/test/dummy/app/models/cat.rb +0 -2
- data/test/dummy/app/models/chapter.rb +0 -9
- data/test/dummy/app/models/citation.rb +0 -5
- data/test/dummy/app/models/customer.rb +0 -4
- data/test/dummy/app/models/document.rb +0 -4
- data/test/dummy/app/models/dog.rb +0 -2
- data/test/dummy/app/models/editor.rb +0 -4
- data/test/dummy/app/models/editorship.rb +0 -5
- data/test/dummy/app/models/elephant.rb +0 -3
- data/test/dummy/app/models/fluxor.rb +0 -3
- data/test/dummy/app/models/foo_widget.rb +0 -2
- data/test/dummy/app/models/fruit.rb +0 -5
- data/test/dummy/app/models/gadget.rb +0 -3
- data/test/dummy/app/models/kitchen/banana.rb +0 -5
- data/test/dummy/app/models/legacy_widget.rb +0 -4
- data/test/dummy/app/models/line_item.rb +0 -4
- data/test/dummy/app/models/not_on_update.rb +0 -4
- data/test/dummy/app/models/order.rb +0 -5
- data/test/dummy/app/models/paragraph.rb +0 -5
- data/test/dummy/app/models/person.rb +0 -38
- data/test/dummy/app/models/post.rb +0 -3
- data/test/dummy/app/models/post_with_status.rb +0 -8
- data/test/dummy/app/models/protected_widget.rb +0 -3
- data/test/dummy/app/models/quotation.rb +0 -5
- data/test/dummy/app/models/section.rb +0 -6
- data/test/dummy/app/models/skipper.rb +0 -6
- data/test/dummy/app/models/song.rb +0 -32
- data/test/dummy/app/models/thing.rb +0 -3
- data/test/dummy/app/models/translation.rb +0 -4
- data/test/dummy/app/models/whatchamajigger.rb +0 -4
- data/test/dummy/app/models/widget.rb +0 -15
- data/test/dummy/app/models/wotsit.rb +0 -8
- data/test/dummy/app/versions/joined_version.rb +0 -5
- data/test/dummy/app/versions/json_version.rb +0 -3
- data/test/dummy/app/versions/kitchen/banana_version.rb +0 -5
- data/test/dummy/app/versions/post_version.rb +0 -3
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -69
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.mysql.yml +0 -19
- data/test/dummy/config/database.postgres.yml +0 -15
- data/test/dummy/config/database.sqlite.yml +0 -15
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -40
- data/test/dummy/config/environments/production.rb +0 -73
- data/test/dummy/config/environments/test.rb +0 -41
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/paper_trail.rb +0 -10
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +0 -287
- data/test/dummy/db/schema.rb +0 -246
- data/test/dummy/script/rails +0 -6
- data/test/functional/controller_test.rb +0 -91
- data/test/functional/enabled_for_controller_test.rb +0 -29
- data/test/functional/modular_sinatra_test.rb +0 -48
- data/test/functional/sinatra_test.rb +0 -49
- data/test/functional/thread_safety_test.rb +0 -48
- data/test/paper_trail_test.rb +0 -38
- data/test/test_helper.rb +0 -105
- data/test/time_travel_helper.rb +0 -15
- data/test/unit/associations_test.rb +0 -726
- data/test/unit/cleaner_test.rb +0 -182
- data/test/unit/inheritance_column_test.rb +0 -43
- data/test/unit/model_test.rb +0 -1373
- data/test/unit/protected_attrs_test.rb +0 -47
- data/test/unit/serializer_test.rb +0 -117
- data/test/unit/serializers/json_test.rb +0 -88
- data/test/unit/serializers/mixin_json_test.rb +0 -36
- data/test/unit/serializers/mixin_yaml_test.rb +0 -49
- data/test/unit/serializers/yaml_test.rb +0 -52
- data/test/unit/timestamp_test.rb +0 -43
- data/test/unit/version_test.rb +0 -119
data/.gitignore
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
NOTES
|
2
|
-
test/debug.log
|
3
|
-
test/paper_trail_plugin.sqlite3.db
|
4
|
-
test/dummy/config/database.yml
|
5
|
-
test/dummy/db/*.sqlite3
|
6
|
-
test/dummy/log/*
|
7
|
-
test/dummy/tmp/*
|
8
|
-
spec/dummy/
|
9
|
-
coverage
|
10
|
-
pkg/*
|
11
|
-
*.gem
|
12
|
-
.bundle
|
13
|
-
.rbenv-version
|
14
|
-
Gemfile.lock
|
15
|
-
gemfiles/*.lock
|
16
|
-
vendor/*
|
17
|
-
.idea
|
18
|
-
.rvmrc
|
19
|
-
.tags
|
20
|
-
.tags_sorted_by_file
|
21
|
-
.ruby-version
|
22
|
-
.ruby-gemset
|
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.0.0
|
4
|
-
- 1.9.3
|
5
|
-
- 1.8.7
|
6
|
-
- jruby-19mode
|
7
|
-
- jruby-18mode
|
8
|
-
env:
|
9
|
-
global:
|
10
|
-
- TRAVIS=true
|
11
|
-
matrix:
|
12
|
-
- DB=mysql
|
13
|
-
- DB=postgres
|
14
|
-
- DB=sqlite
|
15
|
-
|
16
|
-
sudo: false
|
17
|
-
|
18
|
-
before_script:
|
19
|
-
- mysql --version
|
20
|
-
- sh -c "if [ \"$DB\" = 'mysql' ]; then mysql -e 'create database paper_trail_test;'; fi"
|
21
|
-
- sh -c "if [ \"$DB\" = 'mysql' ]; then mysql -e 'create database paper_trail_bar; '; fi"
|
22
|
-
- sh -c "if [ \"$DB\" = 'mysql' ]; then mysql -e 'create database paper_trail_foo; '; fi"
|
23
|
-
- psql --version
|
24
|
-
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_test;' -U postgres; fi"
|
25
|
-
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_bar;' -U postgres; fi"
|
26
|
-
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_foo;' -U postgres; fi"
|
27
|
-
|
28
|
-
gemfile:
|
29
|
-
- Gemfile
|
30
|
-
- gemfiles/ar3.gemfile
|
31
|
-
|
32
|
-
matrix:
|
33
|
-
fast_finish: true
|
34
|
-
allow_failures:
|
35
|
-
- rvm: jruby-18mode
|
36
|
-
gemfile: Gemfile
|
37
|
-
- rvm: 1.8.7
|
38
|
-
gemfile: Gemfile
|
39
|
-
|
40
|
-
addons:
|
41
|
-
postgresql: "9.4"
|
data/CHANGELOG.md
DELETED
@@ -1,362 +0,0 @@
|
|
1
|
-
## 4.2.0 (2016-05-31)
|
2
|
-
|
3
|
-
### Breaking Changes
|
4
|
-
|
5
|
-
- None
|
6
|
-
|
7
|
-
### Added
|
8
|
-
|
9
|
-
- [#808](https://github.com/airblade/paper_trail/pull/808) -
|
10
|
-
Warn when destroy callback is set to :after with ActiveRecord 5
|
11
|
-
option `belongs_to_required_by_default` set to `true`.
|
12
|
-
|
13
|
-
### Fixed
|
14
|
-
|
15
|
-
- None
|
16
|
-
|
17
|
-
## 4.1.0 (2016-01-30)
|
18
|
-
|
19
|
-
### Breaking Changes
|
20
|
-
|
21
|
-
- None
|
22
|
-
|
23
|
-
### Added
|
24
|
-
|
25
|
-
- A way to control the order of AR callbacks.
|
26
|
-
[#614](https://github.com/airblade/paper_trail/pull/614)
|
27
|
-
- Added `unversioned_attributes` option to `reify`.
|
28
|
-
[#579](https://github.com/airblade/paper_trail/pull/579)
|
29
|
-
|
30
|
-
### Fixed
|
31
|
-
|
32
|
-
- None
|
33
|
-
|
34
|
-
## 4.0.2
|
35
|
-
|
36
|
-
### Breaking Changes
|
37
|
-
|
38
|
-
- None
|
39
|
-
|
40
|
-
### Added
|
41
|
-
|
42
|
-
- None
|
43
|
-
|
44
|
-
### Fixed
|
45
|
-
|
46
|
-
- [#696](https://github.com/airblade/paper_trail/issues/696) /
|
47
|
-
[#697](https://github.com/airblade/paper_trail/pull/697)
|
48
|
-
Bind JSON query parameters in `where_object` and `where_object_changes`.
|
49
|
-
|
50
|
-
## 4.0.1
|
51
|
-
|
52
|
-
### Breaking Changes
|
53
|
-
|
54
|
-
- None
|
55
|
-
|
56
|
-
### Added
|
57
|
-
|
58
|
-
- None
|
59
|
-
|
60
|
-
### Fixed
|
61
|
-
|
62
|
-
- [#636](https://github.com/airblade/paper_trail/issues/636) -
|
63
|
-
Should compile assets without a db connection
|
64
|
-
- [#589](https://github.com/airblade/paper_trail/pull/589) /
|
65
|
-
[#588](https://github.com/airblade/paper_trail/issues/588) -
|
66
|
-
Fixes timestamp for "create" versions
|
67
|
-
|
68
|
-
## 4.0.0
|
69
|
-
|
70
|
-
This major release adds JSON column support in PostgreSQL, limited support for
|
71
|
-
versioning associations, various new configuration options, and a year's worth
|
72
|
-
of bug fixes. Thanks to everyone who helped test the two betas and two release
|
73
|
-
candidates.
|
74
|
-
|
75
|
-
### Breaking Changes
|
76
|
-
|
77
|
-
- Using a Rails initializer to reopen PaperTrail::Version or otherwise extend
|
78
|
-
PaperTrail is no longer recommended. An alternative is described in the
|
79
|
-
readme. See https://github.com/airblade/paper_trail/pull/557 and
|
80
|
-
https://github.com/airblade/paper_trail/pull/492.
|
81
|
-
- If you depend on the `RSpec` or `Cucumber` helpers, you must
|
82
|
-
[require them in your test helper](https://github.com/airblade/paper_trail#testing).
|
83
|
-
- [#566](https://github.com/airblade/paper_trail/pull/566) - Removed deprecated
|
84
|
-
methods `paper_trail_on` and `paper_trail_off`. Use `paper_trail_on!` and
|
85
|
-
`paper_trail_off!` instead.
|
86
|
-
- [#458](https://github.com/airblade/paper_trail/pull/458) - Version metadata
|
87
|
-
(the `:meta` option) from AR attributes for `create` events will now save the
|
88
|
-
current value instead of `nil`.
|
89
|
-
- [#391](https://github.com/airblade/paper_trail/issues/391) - `object_changes`
|
90
|
-
value should dump to `YAML` as a normal `Hash` instead of an
|
91
|
-
`ActiveSupport::HashWithIndifferentAccess`.
|
92
|
-
- [#375](https://github.com/airblade/paper_trail/pull/375) /
|
93
|
-
[#374](https://github.com/airblade/paper_trail/issues/374) /
|
94
|
-
[#354](https://github.com/airblade/paper_trail/issues/354) /
|
95
|
-
[#131](https://github.com/airblade/paper_trail/issues/131) -
|
96
|
-
Versions are now saved with an `after_` callback, instead of a `before_`
|
97
|
-
callback. This ensures that the timestamp field for a version matches the
|
98
|
-
corresponding timestamp in the model.
|
99
|
-
- `3da1f104` - `PaperTrail.config` and `PaperTrail.configure` are now
|
100
|
-
identical: both return the `PaperTrail::Config` instance and also
|
101
|
-
yield it if a block is provided.
|
102
|
-
|
103
|
-
### Added
|
104
|
-
|
105
|
-
- [#525](https://github.com/airblade/paper_trail/issues/525) /
|
106
|
-
[#512](https://github.com/airblade/paper_trail/pull/512) -
|
107
|
-
Support for virtual accessors and redefined setter and getter methods.
|
108
|
-
- [#518](https://github.com/airblade/paper_trail/pull/518) - Support for
|
109
|
-
querying against PostgreSQL's
|
110
|
-
[`JSON` and `JSONB` column types](http://www.postgresql.org/docs/9.4/static/datatype-json.html)
|
111
|
-
via `PaperTrail::VersionConcern#where_object` and
|
112
|
-
`PaperTrail::VersionConcern#where_object_changes`
|
113
|
-
- [#507](https://github.com/airblade/paper_trail/pull/507) -
|
114
|
-
New option: `:save_changes` controls whether or not to save changes to the
|
115
|
-
`object_changes` column (if it exists).
|
116
|
-
- [#500](https://github.com/airblade/paper_trail/pull/500) - Support for
|
117
|
-
passing an empty array to the `on` option (`on: []`) to disable all
|
118
|
-
automatic versioning.
|
119
|
-
- [#494](https://github.com/airblade/paper_trail/issues/494) - The install
|
120
|
-
generator will warn the user if the migration they are attempting to
|
121
|
-
generate already exists.
|
122
|
-
- [#484](https://github.com/airblade/paper_trail/pull/484) - Support for
|
123
|
-
[PostgreSQL's `JSONB` Type](http://www.postgresql.org/docs/9.4/static/datatype-json.html)
|
124
|
-
for storing `object` and `object_changes`.
|
125
|
-
- [#439](https://github.com/airblade/paper_trail/pull/439) /
|
126
|
-
[#12](https://github.com/airblade/paper_trail/issues/12) -
|
127
|
-
Support for versioning associations (has many, has one, etc.) one level deep.
|
128
|
-
- [#420](https://github.com/airblade/paper_trail/issues/420) - Add
|
129
|
-
`VersionConcern#where_object_changes` instance method; acts as a helper for
|
130
|
-
querying against the `object_changes` column in versions table.
|
131
|
-
- [#416](https://github.com/airblade/paper_trail/issues/416) - Added a
|
132
|
-
`config` option for enabling/disabling utilization of
|
133
|
-
`serialized_attributes` for `ActiveRecord`, necessary because
|
134
|
-
`serialized_attributes` has been deprecated in `ActiveRecord` version `4.2`
|
135
|
-
and will be removed in version `5.0`
|
136
|
-
- [#399](https://github.com/airblade/paper_trail/pull/399) - Add `:dup`
|
137
|
-
argument for options hash to `reify` which forces a new model instance.
|
138
|
-
- [#394](https://github.com/airblade/paper_trail/pull/394) - Add RSpec matcher
|
139
|
-
`have_a_version_with` for easier testing.
|
140
|
-
- [#347](https://github.com/airblade/paper_trail/pull/347) - Autoload
|
141
|
-
`ActiveRecord` models in via a `Rails::Engine` when the gem is used with
|
142
|
-
`Rails`.
|
143
|
-
|
144
|
-
### Fixed
|
145
|
-
|
146
|
-
- [#563](https://github.com/airblade/paper_trail/pull/563) - Fixed a bug in
|
147
|
-
`touch_with_version` so that it will still create a version even when the
|
148
|
-
`on` option is, e.g. `[:create]`.
|
149
|
-
- [#541](https://github.com/airblade/paper_trail/pull/541) -
|
150
|
-
`PaperTrail.config.enabled` should be Thread Safe
|
151
|
-
- [#451](https://github.com/airblade/paper_trail/issues/451) - Fix `reify`
|
152
|
-
method in context of model where the base class has a default scope, and the
|
153
|
-
live instance is not scoped within that default scope.
|
154
|
-
- [#440](https://github.com/airblade/paper_trail/pull/440) - `versions`
|
155
|
-
association should clear/reload after a transaction rollback.
|
156
|
-
- [#438](https://github.com/airblade/paper_trail/issues/438) -
|
157
|
-
`ModelKlass.paper_trail_enabled_for_model?` should return `false` if
|
158
|
-
`has_paper_trail` has not been declared on the class.
|
159
|
-
- [#404](https://github.com/airblade/paper_trail/issues/404) /
|
160
|
-
[#428](https://github.com/airblade/paper_trail/issues/428) -
|
161
|
-
`model_instance.dup` does not need to be invoked when examining what the
|
162
|
-
instance looked like before changes were persisted, which avoids issues if a
|
163
|
-
3rd party has overriden the `dup` behavior. Also fixes errors occuring when
|
164
|
-
a user attempts to update the inheritance column on an STI model instance in
|
165
|
-
`ActiveRecord` 4.1.x
|
166
|
-
- [#427](https://github.com/airblade/paper_trail/pull/427) - Fix `reify`
|
167
|
-
method in context of model where a column has been removed.
|
168
|
-
- [#414](https://github.com/airblade/paper_trail/issues/414) - Fix
|
169
|
-
functionality `ignore` argument to `has_paper_trail` in `ActiveRecord` 4.
|
170
|
-
- [#413](https://github.com/airblade/paper_trail/issues/413) - Utilize
|
171
|
-
[RequestStore](https://github.com/steveklabnik/request_store) to ensure that
|
172
|
-
the `PaperTrail.whodunnit` is set in a thread safe manner within Rails and
|
173
|
-
Sinatra.
|
174
|
-
- [#381](https://github.com/airblade/paper_trail/issues/381) - Fix `irb`
|
175
|
-
warning: `can't alias context from irb_context`. `Rspec` and `Cucumber`
|
176
|
-
helpers should not be loaded by default, regardless of whether those
|
177
|
-
libraries are loaded.
|
178
|
-
- [#248](https://github.com/airblade/paper_trail/issues/248) - In MySQL, to
|
179
|
-
prevent truncation, generated migrations now use `longtext` instead of `text`.
|
180
|
-
- Methods handling serialized attributes should fallback to the currently set
|
181
|
-
Serializer instead of always falling back to `PaperTrail::Serializers::YAML`.
|
182
|
-
|
183
|
-
### Deprecated
|
184
|
-
|
185
|
-
- [#479](https://github.com/airblade/paper_trail/issues/479) - Deprecated
|
186
|
-
`originator` method, use `paper_trail_originator`.
|
187
|
-
|
188
|
-
## 3.0.9
|
189
|
-
|
190
|
-
- [#479](https://github.com/airblade/paper_trail/issues/479) - Deprecated
|
191
|
-
`originator` method in favor of `paper_trail_originator` Deprecation warning
|
192
|
-
informs users that the `originator` of the methods will be removed in
|
193
|
-
version `4.0`. (Backported from v4)
|
194
|
-
- Updated deprecation warnings for `Model.paper_trail_on` and
|
195
|
-
`Model.paper_trail_off` to have display correct version number the methods
|
196
|
-
will be removed (`4.0`)
|
197
|
-
|
198
|
-
## 3.0.8
|
199
|
-
|
200
|
-
- [#525](https://github.com/airblade/paper_trail/issues/525) / [#512](https://github.com/airblade/paper_trail/pull/512) -
|
201
|
-
Support for virtual accessors and redefined setter and getter methods.
|
202
|
-
|
203
|
-
## 3.0.7
|
204
|
-
|
205
|
-
- [#404](https://github.com/airblade/paper_trail/issues/404) / [#428](https://github.com/airblade/paper_trail/issues/428) -
|
206
|
-
Fix errors occuring when a user attempts to update the inheritance column on an STI model instance in `ActiveRecord` 4.1.x
|
207
|
-
|
208
|
-
## 3.0.6
|
209
|
-
|
210
|
-
- [#414](https://github.com/airblade/paper_trail/issues/414) - Backport fix for `ignore` argument to `has_paper_trail` in
|
211
|
-
`ActiveRecord` 4.
|
212
|
-
|
213
|
-
## 3.0.5
|
214
|
-
|
215
|
-
- [#401](https://github.com/airblade/paper_trail/issues/401) / [#406](https://github.com/airblade/paper_trail/issues/406) -
|
216
|
-
`PaperTrail::Version` class is not loaded via a `Rails::Engine`, even when the gem is used with in Rails. This feature has
|
217
|
-
will be re-introduced in version `4.0`.
|
218
|
-
- [#398](https://github.com/airblade/paper_trail/pull/398) - Only require the `RSpec` helper if `RSpec::Core` is required.
|
219
|
-
|
220
|
-
## 3.0.3
|
221
|
-
*This version was yanked from RubyGems and has been replaced by version `3.0.5`, which is almost identical, but does not eager load
|
222
|
-
in the `PaperTrail::Version` class through a `Rails::Engine` when the gem is used on Rails since it was causing issues for some users.*
|
223
|
-
|
224
|
-
- [#386](https://github.com/airblade/paper_trail/issues/386) - Fix eager loading of `versions` association with custom class name
|
225
|
-
in `ActiveRecord` 4.1.
|
226
|
-
- [#384](https://github.com/airblade/paper_trail/issues/384) - Fix `VersionConcern#originator` instance method.
|
227
|
-
- [#383](https://github.com/airblade/paper_trail/pull/383) - Make gem compatible with `ActiveRecord::Enum` (available in `ActiveRecord` 4.1+).
|
228
|
-
- [#380](https://github.com/airblade/paper_trail/pull/380) / [#377](https://github.com/airblade/paper_trail/issues/377) -
|
229
|
-
Add `VersionConcern#where_object` instance method; acts as a helper for querying against the `object` column in versions table.
|
230
|
-
- [#373](https://github.com/airblade/paper_trail/pull/373) - Fix default sort order for the `versions` association in `ActiveRecord` 4.1.
|
231
|
-
- [#372](https://github.com/airblade/paper_trail/pull/372) - Use [Arel](https://github.com/rails/arel) for SQL construction.
|
232
|
-
- [#365](https://github.com/airblade/paper_trail/issues/365) - `VersionConcern#version_at` should return `nil` when receiving a timestamp
|
233
|
-
that occured after the object was destroyed.
|
234
|
-
- Expand `PaperTrail::VERSION` into a module, mimicking the form used by Rails to give it some additional modularity & versatility.
|
235
|
-
- Fixed `VersionConcern#index` instance method so that it conforms to using the primary key for ordering when possible.
|
236
|
-
|
237
|
-
## 3.0.2
|
238
|
-
|
239
|
-
- [#357](https://github.com/airblade/paper_trail/issues/357) - If a `Version` instance is reified and then persisted at that state,
|
240
|
-
it's timestamp attributes for update should still get `touch`ed.
|
241
|
-
- [#351](https://github.com/airblade/paper_trail/pull/351) / [#352](https://github.com/airblade/paper_trail/pull/352) -
|
242
|
-
`PaperTrail::Rails::Controller` should hook into all controller types, and should not get loaded unless `ActionController` is.
|
243
|
-
- [#346](https://github.com/airblade/paper_trail/pull/346) - `user_for_paper_trail` method should accommodate different types
|
244
|
-
for return values from `current_user` method.
|
245
|
-
- [#344](https://github.com/airblade/paper_trail/pull/344) - Gem is now tested against `MySQL` and `PostgreSQL` in addition to `SQLite`.
|
246
|
-
- [#317](https://github.com/airblade/paper_trail/issues/317) / [#314](https://github.com/airblade/paper_trail/issues/314) -
|
247
|
-
`versions` should default to ordering via the primary key if it is an integer to avoid timestamp comparison issues.
|
248
|
-
- `PaperTrail::Cleaner.clean_versions!` should group versions by `PaperTrail.timestamp_field` when deciding which ones to
|
249
|
-
keep / destroy, instead of always grouping by the `created_at` field.
|
250
|
-
- If a `Version` instance is reified and then persisted at that state, it's source version
|
251
|
-
(`model_instance#version_association_name`, usually `model_instance#version`) will get cleared since persisting it causes it to
|
252
|
-
become the live instance.
|
253
|
-
- If `destroy` actions are tracked for a versioned model, invoking `destroy` on the model will cause the corresponding version that
|
254
|
-
gets generated to be assigned as the source version (`model_instance#version_association_name`, usually `model_instance#version`).
|
255
|
-
|
256
|
-
## 3.0.1
|
257
|
-
|
258
|
-
- [#340](https://github.com/airblade/paper_trail/issues/340) - Prevent potential error encountered when using the `InstallGenerator`
|
259
|
-
with Rails `4.1.0.rc1`.
|
260
|
-
- [#334](https://github.com/airblade/paper_trail/pull/334) - Add small-scope `whodunnit` method to `PaperTrail::Model::InstanceMethods`.
|
261
|
-
- [#329](https://github.com/airblade/paper_trail/issues/329) - Add `touch_with_version` method to `PaperTrail::Model::InstanceMethods`,
|
262
|
-
to allow for generating a version while `touch`ing a model.
|
263
|
-
- [#328](https://github.com/airblade/paper_trail/pull/328) / [#326](https://github.com/airblade/paper_trail/issues/326) /
|
264
|
-
[#307](https://github.com/airblade/paper_trail/issues/307) - `Model.paper_trail_enabled_for_model?` and
|
265
|
-
`model_instance.without_versioning` is now thread-safe.
|
266
|
-
- [#316](https://github.com/airblade/paper_trail/issues/316) - `user_for_paper_trail` should default to `current_user.try(:id)`
|
267
|
-
instead of `current_user` (if `current_user` is defined).
|
268
|
-
- [#313](https://github.com/airblade/paper_trail/pull/313) - Make the `Rails::Controller` helper compatible with
|
269
|
-
`ActionController::API` for compatibility with the [`rails-api`](https://github.com/rails-api/rails-api) gem.
|
270
|
-
- [#312](https://github.com/airblade/paper_trail/issues/312) - Fix RSpec `with_versioning` class level helper method.
|
271
|
-
- `model_instance.without_versioning` now yields the `model_instance`, enabling syntax like this:
|
272
|
-
`model_instance.without_versioning { |obj| obj.update_attributes(:name => 'value') }`.
|
273
|
-
- Deprecated `Model.paper_trail_on` and `Model.paper_trail_off` in favor of bang versions of the methods.
|
274
|
-
Deprecation warning informs users that the non-bang versions of the methods will be removed in version `4.0`
|
275
|
-
|
276
|
-
## 3.0.0
|
277
|
-
|
278
|
-
- [#305](https://github.com/airblade/paper_trail/pull/305) - `PaperTrail::VERSION` should be loaded at runtime.
|
279
|
-
- [#295](https://github.com/airblade/paper_trail/issues/295) - Explicitly specify table name for version class when
|
280
|
-
querying attributes. Prevents `AmbiguousColumn` errors on certain `JOIN` statements.
|
281
|
-
- [#289](https://github.com/airblade/paper_trail/pull/289) - Use `ActiveSupport::Concern` for implementation of base functionality on
|
282
|
-
`PaperTrail::Version` class. Increases flexibility and makes it easier to use custom version classes with multiple `ActiveRecord` connections.
|
283
|
-
- [#288](https://github.com/airblade/paper_trail/issues/288) - Change all scope declarations to class methods on the `PaperTrail::Version`
|
284
|
-
class. Fixes usability when `PaperTrail::Version.abstract_class? == true`.
|
285
|
-
- [#287](https://github.com/airblade/paper_trail/issues/287) - Support for
|
286
|
-
[PostgreSQL's JSON Type](http://www.postgresql.org/docs/9.2/static/datatype-json.html) for storing `object` and `object_changes`.
|
287
|
-
- [#281](https://github.com/airblade/paper_trail/issues/281) - `Rails::Controller` helper will return `false` for the
|
288
|
-
`paper_trail_enabled_for_controller` method if `PaperTrail.enabled? == false`.
|
289
|
-
- [#280](https://github.com/airblade/paper_trail/pull/280) - Don't track virtual timestamp attributes.
|
290
|
-
- [#278](https://github.com/airblade/paper_trail/issues/278) / [#272](https://github.com/airblade/paper_trail/issues/272) -
|
291
|
-
Make RSpec and Cucumber helpers usable with [Spork](https://github.com/sporkrb/spork) and [Zeus](https://github.com/burke/zeus).
|
292
|
-
- [#273](https://github.com/airblade/paper_trail/pull/273) - Make the `only` and `ignore` options accept `Hash` arguments;
|
293
|
-
allows for conditional tracking.
|
294
|
-
- [#264](https://github.com/airblade/paper_trail/pull/264) - Allow unwrapped symbol to be passed in to the `on` option.
|
295
|
-
- [#224](https://github.com/airblade/paper_trail/issues/224)/[#236](https://github.com/airblade/paper_trail/pull/236) -
|
296
|
-
Fixed compatibility with [ActsAsTaggableOn](https://github.com/mbleigh/acts-as-taggable-on).
|
297
|
-
- [#235](https://github.com/airblade/paper_trail/pull/235) - Dropped unnecessary secondary sort on `versions` association.
|
298
|
-
- [#216](https://github.com/airblade/paper_trail/pull/216) - Added helper & extension for [RSpec](https://github.com/rspec/rspec),
|
299
|
-
and helper for [Cucumber](http://cukes.info).
|
300
|
-
- [#212](https://github.com/airblade/paper_trail/pull/212) - Added `PaperTrail::Cleaner` module, useful for discarding draft versions.
|
301
|
-
- [#207](https://github.com/airblade/paper_trail/issues/207) - Versions for `'create'` events are now created with `create!` instead of
|
302
|
-
`create` so that an exception gets raised if it is appropriate to do so.
|
303
|
-
- [#199](https://github.com/airblade/paper_trail/pull/199) - Rails 4 compatibility.
|
304
|
-
- [#165](https://github.com/airblade/paper_trail/pull/165) - Namespaced the `Version` class under the `PaperTrail` module.
|
305
|
-
- [#119](https://github.com/airblade/paper_trail/issues/119) - Support for [Sinatra](http://www.sinatrarb.com/); decoupled gem from `Rails`.
|
306
|
-
- Renamed the default serializers from `PaperTrail::Serializers::Yaml` and `PaperTrail::Serializers::Json` to the capitalized forms,
|
307
|
-
`PaperTrail::Serializers::YAML` and `PaperTrail::Serializers::JSON`.
|
308
|
-
- Removed deprecated `set_whodunnit` method from Rails Controller scope.
|
309
|
-
|
310
|
-
## 2.7.2
|
311
|
-
|
312
|
-
- [#228](https://github.com/airblade/paper_trail/issues/228) - Refactored default `user_for_paper_trail` method implementation
|
313
|
-
so that `current_user` only gets invoked if it is defined.
|
314
|
-
- [#219](https://github.com/airblade/paper_trail/pull/219) - Fixed issue where attributes stored with `nil` value might not get
|
315
|
-
reified properly depending on the way the serializer worked.
|
316
|
-
- [#213](https://github.com/airblade/paper_trail/issues/213) - Added a `version_limit` option to the `PaperTrail::Config` options
|
317
|
-
that can be used to restrict the number of versions PaperTrail will store per object instance.
|
318
|
-
- [#187](https://github.com/airblade/paper_trail/pull/187) - Confirmed JRuby support.
|
319
|
-
- [#174](https://github.com/airblade/paper_trail/pull/174) - The `event` field on the versions table can now be customized.
|
320
|
-
|
321
|
-
## 2.7.1
|
322
|
-
|
323
|
-
- [#206](https://github.com/airblade/paper_trail/issues/206) - Fixed Ruby 1.8.7 compatibility for tracking `object_changes`.
|
324
|
-
- [#200](https://github.com/airblade/paper_trail/issues/200) - Fixed `next_version` method so that it returns the live model
|
325
|
-
when called on latest reified version of a model prior to the live model.
|
326
|
-
- [#197](https://github.com/airblade/paper_trail/issues/197) - PaperTrail now falls back on using YAML for serialization of
|
327
|
-
serialized model attributes for storage in the `object` and `object_changes` columns in the `Version` table. This fixes
|
328
|
-
compatibility for `Rails 3.0.x` for projects that employ the `serialize` declaration on a model.
|
329
|
-
- [#194](https://github.com/airblade/paper_trail/issues/194) - A JSON serializer is now included in the gem.
|
330
|
-
- [#192](https://github.com/airblade/paper_trail/pull/192) - `object_changes` should store serialized representation of serialized
|
331
|
-
attributes for `create` actions (in addition to `update` actions, which had already been patched by
|
332
|
-
[#180](https://github.com/airblade/paper_trail/pull/180)).
|
333
|
-
- [#190](https://github.com/airblade/paper_trail/pull/190) - Fixed compatibility with
|
334
|
-
[SerializedAttributes](https://github.com/technoweenie/serialized_attributes) gem.
|
335
|
-
- [#189](https://github.com/airblade/paper_trail/pull/189) - Provided support for a `configure` block initializer.
|
336
|
-
- Added `setter` method for the `serializer` config option.
|
337
|
-
|
338
|
-
## 2.7.0
|
339
|
-
|
340
|
-
- [#183](https://github.com/airblade/paper_trail/pull/183) - Fully qualify the `Version` class to help prevent
|
341
|
-
namespace resolution errors within other gems / plugins.
|
342
|
-
- [#180](https://github.com/airblade/paper_trail/pull/180) - Store serialized representation of serialized attributes
|
343
|
-
on the `object` and `object_changes` columns in the `Version` table.
|
344
|
-
- [#164](https://github.com/airblade/paper_trail/pull/164) - Allow usage of custom serializer for storage of object attributes.
|
345
|
-
|
346
|
-
## 2.6.4
|
347
|
-
|
348
|
-
- [#181](https://github.com/airblade/paper_trail/issues/181)/[#182](https://github.com/airblade/paper_trail/pull/182) -
|
349
|
-
Controller metadata methods should only be evaluated when `paper_trail_enabled_for_controller == true`.
|
350
|
-
- [#177](https://github.com/airblade/paper_trail/issues/177)/[#178](https://github.com/airblade/paper_trail/pull/178) -
|
351
|
-
Factored out `version_key` into it's own method to prevent `ConnectionNotEstablished` error from getting thrown in
|
352
|
-
instances where `has_paper_trail` is declared on class prior to ActiveRecord establishing a connection.
|
353
|
-
- [#176](https://github.com/airblade/paper_trail/pull/176) - Force metadata calls for attributes to use current value
|
354
|
-
if attribute value is changing.
|
355
|
-
- [#173](https://github.com/airblade/paper_trail/pull/173) - Update link to [diff-lcs](https://github.com/halostatue/diff-lcs).
|
356
|
-
- [#172](https://github.com/airblade/paper_trail/pull/172) - Save `object_changes` on creation.
|
357
|
-
- [#168](https://github.com/airblade/paper_trail/pull/168) - Respect conditional `:if` or `:unless` arguments to the
|
358
|
-
`has_paper_trail` method for `destroy` events.
|
359
|
-
- [#167](https://github.com/airblade/paper_trail/pull/167) - Fix `originator` method so that it works with subclasses and STI.
|
360
|
-
- [#160](https://github.com/airblade/paper_trail/pull/160) - Fixed failing tests and resolved out of date dependency issues.
|
361
|
-
- [#157](https://github.com/airblade/paper_trail/pull/157) - Refactored `class_attribute` names on the `ClassMethods` module
|
362
|
-
for names that are not obviously pertaining to PaperTrail to prevent method name collision.
|
data/CONTRIBUTING.md
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
Thanks for your interest in PaperTrail!
|
4
|
-
|
5
|
-
Ask usage questions on Stack Overflow:
|
6
|
-
http://stackoverflow.com/tags/papertrail
|
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. contains a rails app with three databases (test, foo, and bar)
|
24
|
-
1. supports three different RDBMS': sqlite, mysql, and postgres
|
25
|
-
|
26
|
-
Run tests with sqlite:
|
27
|
-
|
28
|
-
```
|
29
|
-
# Create the appropriate database config. file
|
30
|
-
rm test/dummy/config/database.yml
|
31
|
-
DB=sqlite bundle exec rake prepare
|
32
|
-
|
33
|
-
# If this is the first test run ever, create databases
|
34
|
-
cd test/dummy
|
35
|
-
RAILS_ENV=test bundle exec rake db:setup
|
36
|
-
RAILS_ENV=foo bundle exec rake db:setup
|
37
|
-
RAILS_ENV=bar bundle exec rake db:setup
|
38
|
-
cd ../..
|
39
|
-
|
40
|
-
# Run tests
|
41
|
-
DB=sqlite bundle exec rake
|
42
|
-
```
|
43
|
-
|
44
|
-
Run tests with mysql:
|
45
|
-
|
46
|
-
```
|
47
|
-
# Create the appropriate database config. file
|
48
|
-
rm test/dummy/config/database.yml
|
49
|
-
DB=mysql bundle exec rake prepare
|
50
|
-
|
51
|
-
# If this is the first test run ever, create databases
|
52
|
-
cd test/dummy
|
53
|
-
RAILS_ENV=test bundle exec rake db:setup
|
54
|
-
RAILS_ENV=foo bundle exec rake db:setup
|
55
|
-
RAILS_ENV=bar bundle exec rake db:setup
|
56
|
-
cd ../..
|
57
|
-
|
58
|
-
# Run tests
|
59
|
-
DB=mysql bundle exec rake
|
60
|
-
```
|
61
|
-
|
62
|
-
Run tests with postgres:
|
63
|
-
|
64
|
-
```
|
65
|
-
# Create the appropriate database config. file
|
66
|
-
rm test/dummy/config/database.yml
|
67
|
-
DB=postgres bundle exec rake prepare
|
68
|
-
|
69
|
-
# If this is the first test run ever, create databases.
|
70
|
-
# Unlike mysql, use create/migrate instead of setup.
|
71
|
-
cd test/dummy
|
72
|
-
RAILS_ENV=test bundle exec rake db:create
|
73
|
-
RAILS_ENV=test bundle exec rake db:migrate
|
74
|
-
RAILS_ENV=foo bundle exec rake db:create
|
75
|
-
RAILS_ENV=foo bundle exec rake db:migrate
|
76
|
-
RAILS_ENV=bar bundle exec rake db:create
|
77
|
-
RAILS_ENV=bar bundle exec rake db:migrate
|
78
|
-
cd ../..
|
79
|
-
|
80
|
-
# Run tests
|
81
|
-
DB=postgres bundle exec rake
|
82
|
-
```
|
83
|
-
|
84
|
-
[1]: https://github.com/airblade/paper_trail/blob/master/doc/bug_report_template.rb
|