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.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/paper_trail/install_generator.rb +91 -17
  3. data/lib/generators/paper_trail/templates/add_object_changes_to_versions.rb.erb +12 -0
  4. data/lib/generators/paper_trail/templates/{add_transaction_id_column_to_versions.rb → add_transaction_id_column_to_versions.rb.erb} +3 -1
  5. data/lib/generators/paper_trail/templates/create_version_associations.rb.erb +22 -0
  6. data/lib/generators/paper_trail/templates/{create_versions.rb → create_versions.rb.erb} +9 -7
  7. data/lib/paper_trail.rb +180 -148
  8. data/lib/paper_trail/attribute_serializers/README.md +10 -0
  9. data/lib/paper_trail/attribute_serializers/cast_attribute_serializer.rb +80 -0
  10. data/lib/paper_trail/attribute_serializers/legacy_active_record_shim.rb +48 -0
  11. data/lib/paper_trail/attribute_serializers/object_attribute.rb +39 -0
  12. data/lib/paper_trail/attribute_serializers/object_changes_attribute.rb +42 -0
  13. data/lib/paper_trail/cleaner.rb +16 -10
  14. data/lib/paper_trail/config.rb +28 -27
  15. data/lib/paper_trail/frameworks/active_record/models/paper_trail/version.rb +5 -1
  16. data/lib/paper_trail/frameworks/active_record/models/paper_trail/version_association.rb +6 -2
  17. data/lib/paper_trail/frameworks/cucumber.rb +1 -0
  18. data/lib/paper_trail/frameworks/rails.rb +2 -7
  19. data/lib/paper_trail/frameworks/rails/controller.rb +20 -18
  20. data/lib/paper_trail/frameworks/rails/engine.rb +6 -1
  21. data/lib/paper_trail/frameworks/rspec.rb +17 -6
  22. data/lib/paper_trail/frameworks/rspec/helpers.rb +3 -1
  23. data/lib/paper_trail/has_paper_trail.rb +25 -503
  24. data/lib/paper_trail/model_config.rb +207 -0
  25. data/lib/paper_trail/queries/versions/where_object.rb +60 -0
  26. data/lib/paper_trail/queries/versions/where_object_changes.rb +68 -0
  27. data/lib/paper_trail/record_history.rb +2 -12
  28. data/lib/paper_trail/record_trail.rb +573 -0
  29. data/lib/paper_trail/reifier.rb +164 -215
  30. data/lib/paper_trail/reifiers/belongs_to.rb +48 -0
  31. data/lib/paper_trail/reifiers/has_and_belongs_to_many.rb +50 -0
  32. data/lib/paper_trail/reifiers/has_many.rb +110 -0
  33. data/lib/paper_trail/reifiers/has_many_through.rb +90 -0
  34. data/lib/paper_trail/reifiers/has_one.rb +76 -0
  35. data/lib/paper_trail/serializers/json.rb +16 -7
  36. data/lib/paper_trail/serializers/yaml.rb +9 -13
  37. data/lib/paper_trail/version_association_concern.rb +3 -5
  38. data/lib/paper_trail/version_concern.rb +138 -111
  39. data/lib/paper_trail/version_number.rb +10 -9
  40. metadata +95 -327
  41. data/.gitignore +0 -22
  42. data/.rspec +0 -2
  43. data/.travis.yml +0 -41
  44. data/CHANGELOG.md +0 -362
  45. data/CONTRIBUTING.md +0 -84
  46. data/Gemfile +0 -2
  47. data/MIT-LICENSE +0 -20
  48. data/README.md +0 -1535
  49. data/Rakefile +0 -30
  50. data/doc/bug_report_template.rb +0 -65
  51. data/gemfiles/ar3.gemfile +0 -61
  52. data/lib/generators/paper_trail/templates/add_object_changes_to_versions.rb +0 -10
  53. data/lib/generators/paper_trail/templates/create_version_associations.rb +0 -17
  54. data/lib/paper_trail/attributes_serialization.rb +0 -89
  55. data/lib/paper_trail/frameworks/sinatra.rb +0 -38
  56. data/paper_trail.gemspec +0 -59
  57. data/spec/generators/install_generator_spec.rb +0 -67
  58. data/spec/models/animal_spec.rb +0 -36
  59. data/spec/models/boolit_spec.rb +0 -48
  60. data/spec/models/callback_modifier_spec.rb +0 -96
  61. data/spec/models/fluxor_spec.rb +0 -19
  62. data/spec/models/gadget_spec.rb +0 -70
  63. data/spec/models/joined_version_spec.rb +0 -47
  64. data/spec/models/json_version_spec.rb +0 -103
  65. data/spec/models/kitchen/banana_spec.rb +0 -14
  66. data/spec/models/not_on_update_spec.rb +0 -19
  67. data/spec/models/post_with_status_spec.rb +0 -17
  68. data/spec/models/skipper_spec.rb +0 -46
  69. data/spec/models/thing_spec.rb +0 -11
  70. data/spec/models/version_spec.rb +0 -239
  71. data/spec/models/widget_spec.rb +0 -298
  72. data/spec/modules/paper_trail_spec.rb +0 -27
  73. data/spec/modules/version_concern_spec.rb +0 -32
  74. data/spec/modules/version_number_spec.rb +0 -44
  75. data/spec/paper_trail/config_spec.rb +0 -52
  76. data/spec/paper_trail_spec.rb +0 -66
  77. data/spec/rails_helper.rb +0 -34
  78. data/spec/requests/articles_spec.rb +0 -30
  79. data/spec/spec_helper.rb +0 -95
  80. data/spec/support/alt_db_init.rb +0 -59
  81. data/test/custom_json_serializer.rb +0 -13
  82. data/test/dummy/Rakefile +0 -7
  83. data/test/dummy/app/controllers/application_controller.rb +0 -20
  84. data/test/dummy/app/controllers/articles_controller.rb +0 -17
  85. data/test/dummy/app/controllers/test_controller.rb +0 -5
  86. data/test/dummy/app/controllers/widgets_controller.rb +0 -31
  87. data/test/dummy/app/helpers/application_helper.rb +0 -2
  88. data/test/dummy/app/models/animal.rb +0 -6
  89. data/test/dummy/app/models/article.rb +0 -16
  90. data/test/dummy/app/models/authorship.rb +0 -5
  91. data/test/dummy/app/models/book.rb +0 -9
  92. data/test/dummy/app/models/boolit.rb +0 -4
  93. data/test/dummy/app/models/callback_modifier.rb +0 -45
  94. data/test/dummy/app/models/cat.rb +0 -2
  95. data/test/dummy/app/models/chapter.rb +0 -9
  96. data/test/dummy/app/models/citation.rb +0 -5
  97. data/test/dummy/app/models/customer.rb +0 -4
  98. data/test/dummy/app/models/document.rb +0 -4
  99. data/test/dummy/app/models/dog.rb +0 -2
  100. data/test/dummy/app/models/editor.rb +0 -4
  101. data/test/dummy/app/models/editorship.rb +0 -5
  102. data/test/dummy/app/models/elephant.rb +0 -3
  103. data/test/dummy/app/models/fluxor.rb +0 -3
  104. data/test/dummy/app/models/foo_widget.rb +0 -2
  105. data/test/dummy/app/models/fruit.rb +0 -5
  106. data/test/dummy/app/models/gadget.rb +0 -3
  107. data/test/dummy/app/models/kitchen/banana.rb +0 -5
  108. data/test/dummy/app/models/legacy_widget.rb +0 -4
  109. data/test/dummy/app/models/line_item.rb +0 -4
  110. data/test/dummy/app/models/not_on_update.rb +0 -4
  111. data/test/dummy/app/models/order.rb +0 -5
  112. data/test/dummy/app/models/paragraph.rb +0 -5
  113. data/test/dummy/app/models/person.rb +0 -38
  114. data/test/dummy/app/models/post.rb +0 -3
  115. data/test/dummy/app/models/post_with_status.rb +0 -8
  116. data/test/dummy/app/models/protected_widget.rb +0 -3
  117. data/test/dummy/app/models/quotation.rb +0 -5
  118. data/test/dummy/app/models/section.rb +0 -6
  119. data/test/dummy/app/models/skipper.rb +0 -6
  120. data/test/dummy/app/models/song.rb +0 -32
  121. data/test/dummy/app/models/thing.rb +0 -3
  122. data/test/dummy/app/models/translation.rb +0 -4
  123. data/test/dummy/app/models/whatchamajigger.rb +0 -4
  124. data/test/dummy/app/models/widget.rb +0 -15
  125. data/test/dummy/app/models/wotsit.rb +0 -8
  126. data/test/dummy/app/versions/joined_version.rb +0 -5
  127. data/test/dummy/app/versions/json_version.rb +0 -3
  128. data/test/dummy/app/versions/kitchen/banana_version.rb +0 -5
  129. data/test/dummy/app/versions/post_version.rb +0 -3
  130. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  131. data/test/dummy/config.ru +0 -4
  132. data/test/dummy/config/application.rb +0 -69
  133. data/test/dummy/config/boot.rb +0 -10
  134. data/test/dummy/config/database.mysql.yml +0 -19
  135. data/test/dummy/config/database.postgres.yml +0 -15
  136. data/test/dummy/config/database.sqlite.yml +0 -15
  137. data/test/dummy/config/environment.rb +0 -5
  138. data/test/dummy/config/environments/development.rb +0 -40
  139. data/test/dummy/config/environments/production.rb +0 -73
  140. data/test/dummy/config/environments/test.rb +0 -41
  141. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  142. data/test/dummy/config/initializers/inflections.rb +0 -10
  143. data/test/dummy/config/initializers/mime_types.rb +0 -5
  144. data/test/dummy/config/initializers/paper_trail.rb +0 -10
  145. data/test/dummy/config/initializers/secret_token.rb +0 -7
  146. data/test/dummy/config/initializers/session_store.rb +0 -8
  147. data/test/dummy/config/locales/en.yml +0 -5
  148. data/test/dummy/config/routes.rb +0 -4
  149. data/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +0 -287
  150. data/test/dummy/db/schema.rb +0 -246
  151. data/test/dummy/script/rails +0 -6
  152. data/test/functional/controller_test.rb +0 -91
  153. data/test/functional/enabled_for_controller_test.rb +0 -29
  154. data/test/functional/modular_sinatra_test.rb +0 -48
  155. data/test/functional/sinatra_test.rb +0 -49
  156. data/test/functional/thread_safety_test.rb +0 -48
  157. data/test/paper_trail_test.rb +0 -38
  158. data/test/test_helper.rb +0 -105
  159. data/test/time_travel_helper.rb +0 -15
  160. data/test/unit/associations_test.rb +0 -726
  161. data/test/unit/cleaner_test.rb +0 -182
  162. data/test/unit/inheritance_column_test.rb +0 -43
  163. data/test/unit/model_test.rb +0 -1373
  164. data/test/unit/protected_attrs_test.rb +0 -47
  165. data/test/unit/serializer_test.rb +0 -117
  166. data/test/unit/serializers/json_test.rb +0 -88
  167. data/test/unit/serializers/mixin_json_test.rb +0 -36
  168. data/test/unit/serializers/mixin_yaml_test.rb +0 -49
  169. data/test/unit/serializers/yaml_test.rb +0 -52
  170. data/test/unit/timestamp_test.rb +0 -43
  171. 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
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
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