mongoid-audit_log 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/mongoid/audit_log/version.rb +1 -1
- data/lib/mongoid/audit_log.rb +7 -0
- data/spec/mongoid/audit_log_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTQ2YWM3MzI1ZTRlMjZjOTZhOWRjN2E5ZTFhOWY4NTRiZGFlNGQyZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGU3Njg2NDY2MGM1ZTY4YzFlM2E5MTY4MDI4MmFmZTA5ODgwMzRkOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Mjc3MzBlNmY5NTIxZjhjZDI5MDZkZTQxZDc3OGJjMDNlMDQ2ZmE2MjBiNTgy
|
10
|
+
Yjk3MDAxZjliY2NiYjMzMmNhMjZjMTE2ZDRjODA5ZTMzNzBiZGY1MWUwZjZi
|
11
|
+
MTFkYjkxZjhkZDgxNjYwNTNmMDRlNTVjYWNiOGMwYmJlMzI0ZDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjIxNTUxYTZhOGY3OTE1ZTEyM2VkOWMyYjJjMDdhZmYwZTc4YmY3M2U5YzIy
|
14
|
+
MDExYTFhY2ZmYmY1ZmYyMmQ0ZTRiZTlhMGNkN2I1ZjY1OTZiMDVlNDEyYTE3
|
15
|
+
N2Y5YTQzNGRiZWFhYWFiZWU2NDg5NmIyODE2NzU1MTMwNzQ1OWU=
|
data/lib/mongoid/audit_log.rb
CHANGED
@@ -32,6 +32,13 @@ module Mongoid
|
|
32
32
|
Thread.current[:mongoid_audit_log_modifier] = nil
|
33
33
|
end
|
34
34
|
|
35
|
+
def self.disable
|
36
|
+
tmp = Thread.current[:mongoid_audit_log_recording]
|
37
|
+
Thread.current[:mongoid_audit_log_recording] = false
|
38
|
+
yield
|
39
|
+
Thread.current[:mongoid_audit_log_recording] = tmp
|
40
|
+
end
|
41
|
+
|
35
42
|
def self.recording?
|
36
43
|
!!Thread.current[:mongoid_audit_log_recording]
|
37
44
|
end
|
@@ -78,6 +78,21 @@ module Mongoid
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
describe '.disable' do
|
82
|
+
it 'can disable recording' do
|
83
|
+
AuditLog.record do
|
84
|
+
product = Product.create!(:name => 'Foo bar')
|
85
|
+
|
86
|
+
AuditLog.disable do
|
87
|
+
product.update_attributes(:name => 'Bar baz')
|
88
|
+
end
|
89
|
+
|
90
|
+
product.name.should == 'Bar baz'
|
91
|
+
product.audit_log_entries.count.should == 1
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
81
96
|
describe 'callbacks' do
|
82
97
|
let(:user) { User.create! }
|
83
98
|
|
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.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Crouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|