mongoid-audit 1.0.0.alpha.1 → 1.0.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0057de0bc4b8086ede177d4e62f00f2afe911a9c
4
- data.tar.gz: a3bc47897234907ac0febea43b6d7062f04be122
3
+ metadata.gz: c09017cfc6cd61cd836ab528bc6c722365331e7b
4
+ data.tar.gz: 7832c2d2eb1e0ba22a573a0c7c553862430c3fed
5
5
  SHA512:
6
- metadata.gz: 4ced31227b1dbdb9bd575ee5d48e03642e2574aa3b1df4836a54f08709cf42e4b24bb6c6c148ad822a442e22372f59bb5bb0180b013a95f82422aff0411f138d
7
- data.tar.gz: b6decdc95280890a88824fc4ec47e3fc8c7c6b08cc488ada2e9208b0eb81240f9cd1796e758118f5b2cd8d74ab235c97b8f97592ec89cf6f908198eae493356c
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.1)
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.4)
15
- actionview (= 4.1.4)
16
- activesupport (= 4.1.4)
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.4)
20
- activesupport (= 4.1.4)
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.4)
24
- activesupport (= 4.1.4)
23
+ activemodel (4.1.5)
24
+ activesupport (= 4.1.5)
25
25
  builder (~> 3.1)
26
- activesupport (4.1.4)
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
- Database storage format for user / modifier in 1.0.0 was changed, since now glebtv_mongoid_userstamp gem is used to store
14
- modifier.
15
-
16
- To migrate your data do:
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 history is fully supported.
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.last['name']
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
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Audit
3
- VERSION = "1.0.0.alpha.1"
3
+ VERSION = "1.0.0.alpha.2"
4
4
  end
5
5
  end
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.1
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-12 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid