hancock_cms_mongoid 2.0.1.2 → 2.0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackable_patch.rb +41 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44840000f5d37bbdaba4a84c47792ccdd334b272
|
4
|
+
data.tar.gz: 93194269b45761b6dddf9d92cdd69161c77fd78b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5135625214c0d83c7fe2440e80b4becde636ebd0e8316c00251fe46029177d69d48654930cfc1b5b3952b5e891269232e1598d93aa96972c49e831b1b810138e
|
7
|
+
data.tar.gz: 40243e58ddb5e882eae76e873e41a00a111bd7508d165345d67af6792414005f5f182bb2218f180062383c715fb4e00ca9af4225aae3fc12ddc7d12d608e7af0
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module TrackablePatch
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
|
6
|
+
include Mongoid::History::Trackable
|
7
|
+
include Mongoid::Userstamp
|
8
|
+
|
9
|
+
track_history({
|
10
|
+
on: :fields,
|
11
|
+
track_create: true,
|
12
|
+
track_destroy: true,
|
13
|
+
track_update: true,
|
14
|
+
modifier_field: :updater,
|
15
|
+
except: ["created_at", "updated_at", "c_at", "u_at"],
|
16
|
+
})
|
17
|
+
|
18
|
+
belongs_to :updater, class_name: Mongoid::History.modifier_class_name, optional: true, validate: false
|
19
|
+
_validators.delete(:updater)
|
20
|
+
_validate_callbacks.each do |callback|
|
21
|
+
if callback.raw_filter.respond_to?(:attributes) and callback.raw_filter.attributes.include?(:updater)
|
22
|
+
_validate_callbacks.delete(callback)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'mongoid-audit/history_tracker'
|
31
|
+
class HistoryTracker
|
32
|
+
|
33
|
+
belongs_to :modifier, class_name: Mongoid::History.modifier_class_name, optional: true, validate: false
|
34
|
+
_validators.delete(:modifier)
|
35
|
+
_validate_callbacks.each do |callback|
|
36
|
+
if callback.raw_filter.respond_to?(:attributes) and callback.raw_filter.attributes.include?(:modifier)
|
37
|
+
_validate_callbacks.delete(callback)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hancock_cms_mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.1.
|
4
|
+
version: 2.0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kiseliev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.0.1.
|
67
|
+
version: 2.0.1.3
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 2.0.1.
|
74
|
+
version: 2.0.1.3
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: glebtv-mongoid_nested_set
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +178,7 @@ extensions: []
|
|
178
178
|
extra_rdoc_files: []
|
179
179
|
files:
|
180
180
|
- lib/hancock_cms_mongoid.rb
|
181
|
+
- lib/trackable_patch.rb
|
181
182
|
homepage: https://github.com/red-rocks/hancock_cms
|
182
183
|
licenses:
|
183
184
|
- MIT
|