paper_trail 4.0.0.rc2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae826d8b61e5942f6eb328508ea052e2c2dbd266
4
- data.tar.gz: 89a118c9f2a5abfec9c5540c4d380c6e6949cac1
3
+ metadata.gz: e6cf60ba027274553881419d2024a86547be00d2
4
+ data.tar.gz: 57495d17ebfa11d24a17cf7d65ba5e67aca92816
5
5
  SHA512:
6
- metadata.gz: 3585236f12597ab00a9092b978094c241028bcb138f247dd0cd7d62f175f38eb627497188da97233984f575b074682bfea3835529cf6530b8f5aa2104123b8c0
7
- data.tar.gz: 7cacf0e8421af9477b5838c6276adb83ac6c52f7de77cdc97719109bbbba6a42e6647ba22bacb3e0fcddfc3a884056ae418375e6cffd7d3b51643b76368707c9
6
+ metadata.gz: d9c462e7bb9dfdf1404de3fb8de7484de342ab0516e0e8eaae67e3059a51e01d0e7c9b1699433857c2045bee768256ab811783ccc8568318cf14dc39c50bd6ff
7
+ data.tar.gz: 1e8c8098fa91e2cb9af8fae20268beceba18e885948a629e5fada7d84d2023159254da16875341436ce620365fb9f28432e4a37159ac7a9c8bc8883a2afef409
@@ -1,4 +1,9 @@
1
- ## 4.0.0 (Unreleased)
1
+ ## 4.0.0
2
+
3
+ This major release adds JSON column support in PostgreSQL, limited support for
4
+ versioning associations, various new configuration options, and a year's worth
5
+ of bug fixes. Thanks to everyone who helped test the two betas and two release
6
+ candidates.
2
7
 
3
8
  ### Changed
4
9
 
@@ -8,104 +13,113 @@
8
13
  https://github.com/airblade/paper_trail/pull/492.
9
14
  - If you depend on the `RSpec` or `Cucumber` helpers, you must
10
15
  [require them in your test helper](https://github.com/airblade/paper_trail#testing).
16
+ - [#458](https://github.com/airblade/paper_trail/pull/458) - Version metadata
17
+ (the `:meta` option) from AR attributes for `create` events will now save the
18
+ current value instead of `nil`.
19
+ - [#391](https://github.com/airblade/paper_trail/issues/391) - `object_changes`
20
+ value should dump to `YAML` as a normal `Hash` instead of an
21
+ `ActiveSupport::HashWithIndifferentAccess`.
22
+ - [#375](https://github.com/airblade/paper_trail/pull/375) /
23
+ [#374](https://github.com/airblade/paper_trail/issues/374) /
24
+ [#354](https://github.com/airblade/paper_trail/issues/354) /
25
+ [#131](https://github.com/airblade/paper_trail/issues/131) -
26
+ Versions are now saved with an `after_` callback, instead of a `before_`
27
+ callback. This ensures that the timestamp field for a version matches the
28
+ corresponding timestamp in the model.
29
+ - `3da1f104` - `PaperTrail.config` and `PaperTrail.configure` are now
30
+ identical: both return the `PaperTrail::Config` instance and also
31
+ 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.
11
38
 
12
39
  ### Added
13
40
 
14
- - [#541](https://github.com/airblade/paper_trail/pull/541) -
15
- `PaperTrail.config.enabled` should be Thread Safe
16
- - [#525](https://github.com/airblade/paper_trail/issues/525) /
17
- [#512](https://github.com/airblade/paper_trail/pull/512) -
18
- Support for virtual accessors and redefined setter and getter methods.
19
- - [#518](https://github.com/airblade/paper_trail/pull/518) - Support for
20
- querying against PostgreSQL's
21
- [`JSON` and `JSONB` column types](http://www.postgresql.org/docs/9.4/static/datatype-json.html)
22
- via `PaperTrail::VersionConcern#where_object` and
23
- `PaperTrail::VersionConcern#where_object_changes`
24
- - [#507](https://github.com/airblade/paper_trail/pull/507) - Support for
25
- opting out of saving changesets on models by choice when the
26
- `object_changes` column exists on the default `versions` table.
27
- - [#500](https://github.com/airblade/paper_trail/pull/500) - Support for
28
- passing `on: []` as an argument, with only manual versioning via calls to
29
- `touch_with_version`
30
- - [#494](https://github.com/airblade/paper_trail/issues/494) - The install
31
- generator will warn the user if the migration they are attempting to
32
- generate already exists.
33
- - [#484](https://github.com/airblade/paper_trail/pull/484) - Support for
34
- [PostgreSQL's `JSONB` Type](http://www.postgresql.org/docs/9.4/static/datatype-json.html)
35
- for storing `object` and `object_changes`.
36
- - [#479](https://github.com/airblade/paper_trail/issues/479) - Deprecated
37
- `originator` method, use `paper_trail_originator`.
38
- - [#458](https://github.com/airblade/paper_trail/pull/458) - For `create`
39
- events, metadata pointing at attributes should attempt to grab the current
40
- value instead of looking at the value prior to the change (which would
41
- always be `nil`)
42
- - [#451](https://github.com/airblade/paper_trail/issues/451) - Fix `reify`
43
- method in context of model where the base class has a default scope, and the
44
- live instance is not scoped within that default scope.
45
- - [#440](https://github.com/airblade/paper_trail/pull/440) - `versions`
46
- association should clear/reload after a transaction rollback.
47
- - [#439](https://github.com/airblade/paper_trail/pull/439) /
48
- [#12](https://github.com/airblade/paper_trail/issues/12) -
49
- Support for versioning of associations (Has Many, Has One, HABTM, etc.)
50
- - [#438](https://github.com/airblade/paper_trail/issues/438) -
51
- `ModelKlass.paper_trail_enabled_for_model?` should return `false` if
52
- `has_paper_trail` has not been declared on the class.
53
- - [#404](https://github.com/airblade/paper_trail/issues/404) /
54
- [#428](https://github.com/airblade/paper_trail/issues/428) -
55
- `model_instance.dup` does not need to be invoked when examining what the
56
- instance looked like before changes were persisted, which avoids issues if a
57
- 3rd party has overriden the `dup` behavior. Also fixes errors occuring when
58
- a user attempts to update the inheritance column on an STI model instance in
59
- `ActiveRecord` 4.1.x
60
- - [#427](https://github.com/airblade/paper_trail/pull/427) - Fix `reify`
61
- method in context of model where a column has been removed.
62
- - [#420](https://github.com/airblade/paper_trail/issues/420) - Add
63
- `VersionConcern#where_object_changes` instance method; acts as a helper for
64
- querying against the `object_changes` column in versions table.
65
- - [#416](https://github.com/airblade/paper_trail/issues/416) - Added a
66
- `config` option for enabling/disabling utilization of
67
- `serialized_attributes` for `ActiveRecord`, necessary because
68
- `serialized_attributes` has been deprecated in `ActiveRecord` version `4.2`
69
- and will be removed in version `5.0`
70
- - [#414](https://github.com/airblade/paper_trail/issues/414) - Fix
71
- functionality `ignore` argument to `has_paper_trail` in `ActiveRecord` 4.
72
- - [#413](https://github.com/airblade/paper_trail/issues/413) - Utilize
73
- [RequestStore](https://github.com/steveklabnik/request_store) to ensure that
74
- the `PaperTrail.whodunnit` is set in a thread safe manner within Rails and
75
- Sinatra.
76
- - [#399](https://github.com/airblade/paper_trail/pull/399) - Add `:dup`
77
- argument for options hash to `reify` which forces a new model instance.
78
- - [#394](https://github.com/airblade/paper_trail/pull/394) - Add RSpec matcher
79
- `have_a_version_with` for easier testing.
80
- - [#391](https://github.com/airblade/paper_trail/issues/391) - `object_changes`
81
- value should dump to `YAML` as a normal `Hash` instead of an
82
- `ActiveSupport::HashWithIndifferentAccess`.
83
- - [#381](https://github.com/airblade/paper_trail/issues/381) - `Rspec`
84
- and `Cucumber` helpers should not be loaded by default, regardless of
85
- whether those libraries are loaded.
86
- - [#375](https://github.com/airblade/paper_trail/pull/375) /
87
- [#374](https://github.com/airblade/paper_trail/issues/374) /
88
- [#354](https://github.com/airblade/paper_trail/issues/354) /
89
- [#131](https://github.com/airblade/paper_trail/issues/131) -
90
- Versions should be built with `after_` callbacks so the timestamp field for
91
- a version can be forced to match the corresponding timestamp in the database
92
- for the state persistence of a change to the base (versioned) model.
93
- - [#347](https://github.com/airblade/paper_trail/pull/347) - Autoload
94
- `ActiveRecord` models in via a `Rails::Engine` when the gem is used with
95
- `Rails`.
96
- - Methods handling serialized attributes should fallback to the currently set
97
- Serializer instead of always falling back to `PaperTrail::Serializers::YAML`.
98
- - Both `PaperTrail.config` and `PaperTrail.configure` are now identical, and
99
- will both return the `PaperTrail::Config` instance and also yield it if a
100
- block is provided.
41
+ - [#525](https://github.com/airblade/paper_trail/issues/525) /
42
+ [#512](https://github.com/airblade/paper_trail/pull/512) -
43
+ Support for virtual accessors and redefined setter and getter methods.
44
+ - [#518](https://github.com/airblade/paper_trail/pull/518) - Support for
45
+ querying against PostgreSQL's
46
+ [`JSON` and `JSONB` column types](http://www.postgresql.org/docs/9.4/static/datatype-json.html)
47
+ via `PaperTrail::VersionConcern#where_object` and
48
+ `PaperTrail::VersionConcern#where_object_changes`
49
+ - [#507](https://github.com/airblade/paper_trail/pull/507) -
50
+ New option: `:save_changes` controls whether or not to save changes to the
51
+ `object_changes` column (if it exists).
52
+ - [#500](https://github.com/airblade/paper_trail/pull/500) - Support for
53
+ passing an empty array to the `on` option (`on: []`) to disable all
54
+ automatic versioning.
55
+ - [#494](https://github.com/airblade/paper_trail/issues/494) - The install
56
+ generator will warn the user if the migration they are attempting to
57
+ generate already exists.
58
+ - [#484](https://github.com/airblade/paper_trail/pull/484) - Support for
59
+ [PostgreSQL's `JSONB` Type](http://www.postgresql.org/docs/9.4/static/datatype-json.html)
60
+ for storing `object` and `object_changes`.
61
+ - [#439](https://github.com/airblade/paper_trail/pull/439) /
62
+ [#12](https://github.com/airblade/paper_trail/issues/12) -
63
+ Support for versioning associations (has many, has one, etc.) one level deep.
64
+ - [#420](https://github.com/airblade/paper_trail/issues/420) - Add
65
+ `VersionConcern#where_object_changes` instance method; acts as a helper for
66
+ querying against the `object_changes` column in versions table.
67
+ - [#416](https://github.com/airblade/paper_trail/issues/416) - Added a
68
+ `config` option for enabling/disabling utilization of
69
+ `serialized_attributes` for `ActiveRecord`, necessary because
70
+ `serialized_attributes` has been deprecated in `ActiveRecord` version `4.2`
71
+ and will be removed in version `5.0`
72
+ - [#399](https://github.com/airblade/paper_trail/pull/399) - Add `:dup`
73
+ argument for options hash to `reify` which forces a new model instance.
74
+ - [#394](https://github.com/airblade/paper_trail/pull/394) - Add RSpec matcher
75
+ `have_a_version_with` for easier testing.
76
+ - [#347](https://github.com/airblade/paper_trail/pull/347) - Autoload
77
+ `ActiveRecord` models in via a `Rails::Engine` when the gem is used with
78
+ `Rails`.
101
79
 
102
80
  ### Fixed
103
81
 
104
- - [#563](https://github.com/airblade/paper_trail/pull/563) - Fixed a bug in
105
- `touch_with_version` so that it will still create a version even when the
106
- `on` option is, e.g. `[:create]`.
107
- - [#248](https://github.com/airblade/paper_trail/issues/248) - In MySQL, to
108
- prevent truncation, generated migrations now use `longtext` instead of `text`.
82
+ - [#563](https://github.com/airblade/paper_trail/pull/563) - Fixed a bug in
83
+ `touch_with_version` so that it will still create a version even when the
84
+ `on` option is, e.g. `[:create]`.
85
+ - [#541](https://github.com/airblade/paper_trail/pull/541) -
86
+ `PaperTrail.config.enabled` should be Thread Safe
87
+ - [#451](https://github.com/airblade/paper_trail/issues/451) - Fix `reify`
88
+ method in context of model where the base class has a default scope, and the
89
+ live instance is not scoped within that default scope.
90
+ - [#440](https://github.com/airblade/paper_trail/pull/440) - `versions`
91
+ association should clear/reload after a transaction rollback.
92
+ - [#438](https://github.com/airblade/paper_trail/issues/438) -
93
+ `ModelKlass.paper_trail_enabled_for_model?` should return `false` if
94
+ `has_paper_trail` has not been declared on the class.
95
+ - [#404](https://github.com/airblade/paper_trail/issues/404) /
96
+ [#428](https://github.com/airblade/paper_trail/issues/428) -
97
+ `model_instance.dup` does not need to be invoked when examining what the
98
+ instance looked like before changes were persisted, which avoids issues if a
99
+ 3rd party has overriden the `dup` behavior. Also fixes errors occuring when
100
+ a user attempts to update the inheritance column on an STI model instance in
101
+ `ActiveRecord` 4.1.x
102
+ - [#427](https://github.com/airblade/paper_trail/pull/427) - Fix `reify`
103
+ method in context of model where a column has been removed.
104
+ - [#414](https://github.com/airblade/paper_trail/issues/414) - Fix
105
+ functionality `ignore` argument to `has_paper_trail` in `ActiveRecord` 4.
106
+ - [#413](https://github.com/airblade/paper_trail/issues/413) - Utilize
107
+ [RequestStore](https://github.com/steveklabnik/request_store) to ensure that
108
+ the `PaperTrail.whodunnit` is set in a thread safe manner within Rails and
109
+ Sinatra.
110
+ - [#381](https://github.com/airblade/paper_trail/issues/381) - Fix `irb`
111
+ warning: `can't alias context from irb_context`. `Rspec` and `Cucumber`
112
+ helpers should not be loaded by default, regardless of whether those
113
+ libraries are loaded.
114
+ - [#248](https://github.com/airblade/paper_trail/issues/248) - In MySQL, to
115
+ prevent truncation, generated migrations now use `longtext` instead of `text`.
116
+ - Methods handling serialized attributes should fallback to the currently set
117
+ Serializer instead of always falling back to `PaperTrail::Serializers::YAML`.
118
+
119
+ ### Deprecated
120
+
121
+ - [#479](https://github.com/airblade/paper_trail/issues/479) - Deprecated
122
+ `originator` method, use `paper_trail_originator`.
109
123
 
110
124
  ## 3.0.8
111
125
 
data/README.md CHANGED
@@ -66,7 +66,7 @@ The Rails 2.3 code is on the [`rails2`][11] branch and tagged `v1.x`. These bran
66
66
 
67
67
  1. Add PaperTrail to your `Gemfile`.
68
68
 
69
- `gem 'paper_trail', '~> 4.0.0.rc'`
69
+ `gem 'paper_trail', '~> 4.0.0'`
70
70
 
71
71
  2. Generate a migration which will add a `versions` table to your database.
72
72
 
@@ -89,7 +89,7 @@ setting up your app with PaperTrail will look something like this:
89
89
 
90
90
  1. Add PaperTrail to your `Gemfile`.
91
91
 
92
- `gem 'paper_trail', '~> 4.0.0.rc'`
92
+ `gem 'paper_trail', '~> 4.0.0'`
93
93
 
94
94
  2. Generate a migration to add a `versions` table to your database.
95
95
 
@@ -149,7 +149,7 @@ end
149
149
 
150
150
  # Require frameworks
151
151
  require 'paper_trail/frameworks/sinatra'
152
- if defined? ::Rails
152
+ if defined?(::Rails) && ActiveRecord::VERSION::STRING >= '3.2'
153
153
  require 'paper_trail/frameworks/rails'
154
154
  else
155
155
  require 'paper_trail/frameworks/active_record'
@@ -96,21 +96,11 @@ module PaperTrail
96
96
  PaperTrail.enabled_for_model(self, false)
97
97
  end
98
98
 
99
- def paper_trail_off
100
- warn "DEPRECATED: use `paper_trail_off!` instead of `paper_trail_off`. Support for `paper_trail_off` will be removed in PaperTrail 4.0"
101
- self.paper_trail_off!
102
- end
103
-
104
99
  # Switches PaperTrail on for this class.
105
100
  def paper_trail_on!
106
101
  PaperTrail.enabled_for_model(self, true)
107
102
  end
108
103
 
109
- def paper_trail_on
110
- warn "DEPRECATED: use `paper_trail_on!` instead of `paper_trail_on`. Support for `paper_trail_on` will be removed in PaperTrail 4.0"
111
- self.paper_trail_on!
112
- end
113
-
114
104
  def paper_trail_enabled_for_model?
115
105
  return false unless self.include?(PaperTrail::Model::InstanceMethods)
116
106
  PaperTrail.enabled_for_model?(self)
@@ -3,7 +3,7 @@ module PaperTrail
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
5
  TINY = 0
6
- PRE = 'rc2'
6
+ PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
 
@@ -282,21 +282,6 @@ describe Widget, :type => :model do
282
282
  end
283
283
  end
284
284
 
285
- describe '#paper_trail_off' do
286
- it { is_expected.to respond_to(:paper_trail_off) }
287
-
288
- it 'should set the invoke `paper_trail_off!`' do
289
- is_expected.to receive(:warn)
290
- is_expected.to receive(:paper_trail_off!)
291
- subject.paper_trail_off
292
- end
293
-
294
- it 'should display a deprecation warning' do
295
- is_expected.to receive(:warn).with("DEPRECATED: use `paper_trail_on!` instead of `paper_trail_on`. Support for `paper_trail_on` will be removed in PaperTrail 4.0")
296
- subject.paper_trail_on
297
- end
298
- end
299
-
300
285
  describe '#paper_trail_on!' do
301
286
  before { subject.paper_trail_off! }
302
287
 
@@ -308,23 +293,6 @@ describe Widget, :type => :model do
308
293
  expect(subject.paper_trail_enabled_for_model?).to be true
309
294
  end
310
295
  end
311
-
312
- describe '#paper_trail_on' do
313
- before { subject.paper_trail_off! }
314
-
315
- it { is_expected.to respond_to(:paper_trail_on) }
316
-
317
- it 'should set the invoke `paper_trail_on!`' do
318
- is_expected.to receive(:warn)
319
- is_expected.to receive(:paper_trail_on!)
320
- subject.paper_trail_on
321
- end
322
-
323
- it 'should display a deprecation warning' do
324
- is_expected.to receive(:warn).with("DEPRECATED: use `paper_trail_on!` instead of `paper_trail_on`. Support for `paper_trail_on` will be removed in PaperTrail 4.0")
325
- subject.paper_trail_on
326
- end
327
- end
328
296
  end
329
297
  end
330
298
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc2
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-20 00:00:00.000000000 Z
12
+ date: 2015-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord