mongoid-audit 1.0.0.alpha.1 → 1.0.0.alpha.2
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/Gemfile.lock +9 -9
- data/README.md +16 -6
- data/lib/mongoid-audit/rails_admin.rb +14 -1
- data/lib/mongoid-audit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c09017cfc6cd61cd836ab528bc6c722365331e7b
|
|
4
|
+
data.tar.gz: 7832c2d2eb1e0ba22a573a0c7c553862430c3fed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6ce65420b734aab239bee9755a1c4cf393c39bcd3492951cfe6b4f297651bbd70e1a101ef588ad7890cc7e641f1a06fa4f544fd5b22f7c84dbb11fd11bb66cf
|
|
7
|
+
data.tar.gz: 31472e60944be9c94136385e0e5b4ef1866b201b20fdc24c76377c1bb73aaf4af43b65dc87638fe510f12c3dff10cbb31e755e88d75844d427d820fea2be85ff
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
mongoid-audit (1.0.0.alpha.
|
|
4
|
+
mongoid-audit (1.0.0.alpha.2)
|
|
5
5
|
activesupport
|
|
6
6
|
glebtv_mongoid_userstamp
|
|
7
7
|
kaminari
|
|
@@ -11,19 +11,19 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
actionpack (4.1.
|
|
15
|
-
actionview (= 4.1.
|
|
16
|
-
activesupport (= 4.1.
|
|
14
|
+
actionpack (4.1.5)
|
|
15
|
+
actionview (= 4.1.5)
|
|
16
|
+
activesupport (= 4.1.5)
|
|
17
17
|
rack (~> 1.5.2)
|
|
18
18
|
rack-test (~> 0.6.2)
|
|
19
|
-
actionview (4.1.
|
|
20
|
-
activesupport (= 4.1.
|
|
19
|
+
actionview (4.1.5)
|
|
20
|
+
activesupport (= 4.1.5)
|
|
21
21
|
builder (~> 3.1)
|
|
22
22
|
erubis (~> 2.7.0)
|
|
23
|
-
activemodel (4.1.
|
|
24
|
-
activesupport (= 4.1.
|
|
23
|
+
activemodel (4.1.5)
|
|
24
|
+
activesupport (= 4.1.5)
|
|
25
25
|
builder (~> 3.1)
|
|
26
|
-
activesupport (4.1.
|
|
26
|
+
activesupport (4.1.5)
|
|
27
27
|
i18n (~> 0.6, >= 0.6.9)
|
|
28
28
|
json (~> 1.7, >= 1.7.7)
|
|
29
29
|
minitest (~> 5.1)
|
data/README.md
CHANGED
|
@@ -10,16 +10,26 @@
|
|
|
10
10
|
Since 1.0.0, mongoid_audit is no longer a fork, but a wrapper of [mongoid-history](https://github.com/aq1018/mongoid-history), providing
|
|
11
11
|
out-of-the-box Userstamp, RailsAdmin integration and easier setup and configuration.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
### Migrating from 0.x.x
|
|
14
|
+
|
|
15
|
+
1) delete the initializer (if you had default settings).
|
|
16
|
+
|
|
17
|
+
2) replace
|
|
18
|
+
```
|
|
19
|
+
include Mongoid::Audit::Trackable
|
|
20
|
+
track_history track_create: true, track_destroy: true
|
|
21
|
+
```
|
|
22
|
+
With:
|
|
23
|
+
```
|
|
24
|
+
include Trackable
|
|
25
|
+
```
|
|
26
|
+
3) Database storage format for user / modifier in 1.0.0 was changed, since now [glebtv_mongoid_userstamp](https://github.com/glebtv/mongoid_userstamp) gem is used to store modifier. To migrate your data you should do something like:
|
|
17
27
|
|
|
18
28
|
HistoryTracker.all.each{|ht| ht.rename(:modifier_id, :updater_id)
|
|
19
29
|
|
|
20
|
-
This gem includes storing modifier, but it is done via ```glebtv_mongoid_userstamp``` and not directly.
|
|
30
|
+
4) This gem includes storing modifier, but it is done via ```glebtv_mongoid_userstamp``` and not directly.
|
|
21
31
|
|
|
22
|
-
RailsAdmin
|
|
32
|
+
5) RailsAdmin auditing adapter is still fully supported.
|
|
23
33
|
|
|
24
34
|
## Installation
|
|
25
35
|
|
|
@@ -32,7 +32,20 @@ module RailsAdmin
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def table
|
|
35
|
-
@version.association_chain.
|
|
35
|
+
if @version.association_chain.length == 1
|
|
36
|
+
@version.association_chain.last['name']
|
|
37
|
+
else
|
|
38
|
+
index = 0
|
|
39
|
+
assoc = @version.association_chain
|
|
40
|
+
while !assoc[index+1].nil?
|
|
41
|
+
table = assoc[index]['name'].constantize.relations[assoc[index+1]['name']][:class_name]
|
|
42
|
+
index += 1
|
|
43
|
+
end
|
|
44
|
+
table
|
|
45
|
+
end
|
|
46
|
+
rescue Exception => e
|
|
47
|
+
puts "mongoid-audit error: #{e.message}"
|
|
48
|
+
nil
|
|
36
49
|
end
|
|
37
50
|
|
|
38
51
|
def username
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongoid-audit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0.alpha.
|
|
4
|
+
version: 1.0.0.alpha.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gleb Tv
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-08-
|
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mongoid
|