paper_trail 2.2.5 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -603,6 +603,7 @@ Many thanks to:
603
603
  * [Dominik Sander](https://github.com/dsander)
604
604
  * [Burke Libbey](https://github.com/burke)
605
605
  * [6twenty](https://github.com/6twenty)
606
+ * [nir0](https://github.com/nir0)
606
607
 
607
608
 
608
609
  ## Inspirations
@@ -118,10 +118,10 @@ module PaperTrail
118
118
  def record_destroy
119
119
  if switched_on? and not new_record?
120
120
  version_class.create merge_metadata(:item_id => self.id,
121
- :item_type => self.class.name,
122
- :event => 'destroy',
123
- :object => object_to_string(item_before_change),
124
- :whodunnit => PaperTrail.whodunnit)
121
+ :item_type => self.class.base_class.name,
122
+ :event => 'destroy',
123
+ :object => object_to_string(item_before_change),
124
+ :whodunnit => PaperTrail.whodunnit)
125
125
  end
126
126
  versions.send :load_target
127
127
  end
@@ -1,3 +1,3 @@
1
1
  module PaperTrail
2
- VERSION = '2.2.5'
2
+ VERSION = '2.2.6'
3
3
  end
@@ -387,17 +387,20 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
387
387
  end
388
388
 
389
389
  should 'reify with the correct type' do
390
- thing = @foo.versions.last.reify
390
+ thing = Version.last.reify
391
391
  assert_kind_of FooWidget, thing
392
+ assert_equal @foo.versions.first, Version.last.previous
393
+ assert_nil Version.last.next
392
394
  end
393
395
 
394
-
395
396
  context 'when destroyed' do
396
397
  setup { @foo.destroy }
397
398
 
398
399
  should 'reify with the correct type' do
399
- thing = @foo.versions.last.reify
400
+ thing = Version.last.reify
400
401
  assert_kind_of FooWidget, thing
402
+ assert_equal @foo.versions[1], Version.last.previous
403
+ assert_nil Version.last.next
401
404
  end
402
405
  end
403
406
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 5
10
- version: 2.2.5
9
+ - 6
10
+ version: 2.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Stewart
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-21 00:00:00 +01:00
18
+ date: 2011-07-11 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency