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 +4 -4
- data/lib/mongoid/audit_log/entry.rb +2 -2
- data/lib/mongoid/audit_log/version.rb +1 -1
- data/spec/mongoid/audit_log/entry_spec.rb +11 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35867d14fd329fd4f087b5f01dab102b2b83bd9d
|
4
|
+
data.tar.gz: a98c23806a1fd139755419984fe9d0e8932b59be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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'])
|
@@ -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.
|
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-
|
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.
|
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:
|