mongoid-audit_log 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd2a9b75ea8803b8c62a52e358adf073ca20cc92
4
- data.tar.gz: '08ee1ca6dd2855610ac0f9e41da2a71f9072b5d5'
3
+ metadata.gz: 35867d14fd329fd4f087b5f01dab102b2b83bd9d
4
+ data.tar.gz: a98c23806a1fd139755419984fe9d0e8932b59be
5
5
  SHA512:
6
- metadata.gz: ca3fb108c8e8c6fcc11bc0cf2c9c3580ace95971c010b58fdba043035b08a754f583882562b720a89193c5f2cc7d4b93f37df578e913cfc569a7e56bc74f236b
7
- data.tar.gz: 4fac09d329077517f1d6277d69929d3feb35410e712c9a119b9d42ff612755b0717ca1ef6a02c624937c3ebad5cfc474a6e91f62925f1bfde47e22473f698b31
6
+ metadata.gz: 2bbbbb0f5b34f99bbc1c7131adf7c8fb4b3482428f2615d3f516de3421a078c5e63908f90b022e590ce056a0bfe6816cc4f61a91d46c2cf160366a788532070f
7
+ data.tar.gz: 183f25bf3f728f06b626802cc034f16f75bc54850e225daafdd76bbb0e0a5e9f445a6e8646f732820c763165f3968e34f1200b54bebea9bba86d67e14d1a2a4a
@@ -76,7 +76,7 @@ module Mongoid
76
76
  return audited if root.blank?
77
77
 
78
78
  if for_embedded_doc?
79
- root['class_name'].constantize.find(root['id'])
79
+ root['class_name'].constantize.where(id: root['id']).first
80
80
  else
81
81
  audited
82
82
  end
@@ -111,7 +111,7 @@ module Mongoid
111
111
  end
112
112
  end
113
113
 
114
- if path['relation'].blank?
114
+ if path['relation'].blank? || relation_match.blank?
115
115
  return relation_match
116
116
  else
117
117
  relation_match.send(path['relation'])
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module AuditLog
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -133,6 +133,17 @@ module Mongoid
133
133
  entry.other.should == nil
134
134
  end
135
135
  end
136
+
137
+ describe '#root' do
138
+ it 'returns nil if cannot be found' do
139
+ product = Product.create!(:name => 'Foo bar')
140
+ AuditLog.record { product.variants.create! }
141
+
142
+ entry = Entry.desc(:created_at).first
143
+ product.destroy
144
+ entry.root.should be_nil
145
+ end
146
+ end
136
147
  end
137
148
  end
138
149
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-audit_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-11 00:00:00.000000000 Z
11
+ date: 2017-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: 1.3.6
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.5.2
100
+ rubygems_version: 2.6.11
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: No fancy versioning, undo, redo, etc. Just saves changes to Mongoid models
@@ -108,4 +108,3 @@ test_files:
108
108
  - spec/mongoid/audit_log_spec.rb
109
109
  - spec/spec_helper.rb
110
110
  - spec/support/models.rb
111
- has_rdoc: