recorder 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/recorder/observer.rb +6 -4
- data/lib/recorder/revision.rb +12 -11
- data/lib/recorder/sidekiq/revisions_worker.rb +2 -1
- data/lib/recorder/tape/record.rb +4 -1
- data/lib/recorder/tape.rb +4 -4
- data/lib/recorder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11964998eab29e2ade0b5991c2dcd55f62918304afab5eab82acb8f7f4574813
|
4
|
+
data.tar.gz: 6a54bce4305e0529736140246332879b95bfb3770396ceb7ef6e4d64e383fd0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be73f56ca6cf864fcce8ff25cb66e2fe0c5b0c5cb59de32eb564c234a6edb5e8bba519d7bdc6255ad4ca559da5eda8456da009a09d376312ee3f23a6b6f84ca5
|
7
|
+
data.tar.gz: 7df337554a0136656250967b56d5df939f3eaf82c5164702ea4f159be322109a77ad994e0653f03616d22485e03c8fa6c06a2c167c3c8c6d8f8d3e3544dfe076
|
data/lib/recorder/observer.rb
CHANGED
@@ -21,11 +21,13 @@ module Recorder
|
|
21
21
|
recorder_dirty? && Recorder.store.recorder_enabled?
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
class_methods do
|
25
|
+
define_method :recorder_options do
|
26
|
+
@recorder_options ||= {}
|
27
|
+
end
|
28
|
+
|
25
29
|
def recorder(options = {})
|
26
|
-
|
27
|
-
options
|
28
|
-
end
|
30
|
+
@recorder_options = options
|
29
31
|
|
30
32
|
after_create do
|
31
33
|
Recorder::Tape.new(self).record_create if recorder_record?
|
data/lib/recorder/revision.rb
CHANGED
@@ -18,6 +18,7 @@ module Recorder
|
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
|
+
belongs_to :item, polymorphic: true, inverse_of: :revisions
|
21
22
|
belongs_to :user
|
22
23
|
|
23
24
|
validates :item_type, presence: true
|
@@ -27,20 +28,20 @@ module Recorder
|
|
27
28
|
|
28
29
|
scope :ordered_by_created_at, -> { order(created_at: :desc) }
|
29
30
|
|
30
|
-
def item
|
31
|
-
|
32
|
-
|
31
|
+
# def item
|
32
|
+
# return @item if defined?(@item)
|
33
|
+
# return if item_id.nil?
|
33
34
|
|
34
|
-
|
35
|
+
# @item = item_type.classify.constantize.new(data['attributes'])
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
# if data['associations'].present?
|
38
|
+
# data['associations'].each do |name, association|
|
39
|
+
# @item.send("build_#{name}", association['attributes'])
|
40
|
+
# end
|
41
|
+
# end
|
41
42
|
|
42
|
-
|
43
|
-
end
|
43
|
+
# @item
|
44
|
+
# end
|
44
45
|
|
45
46
|
# Get changeset for an item
|
46
47
|
# @return [Recorder::Changeset]
|
data/lib/recorder/tape/record.rb
CHANGED
@@ -29,9 +29,12 @@ module Recorder
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def record_async(params, options)
|
32
|
+
params[:data] = params[:data].to_json
|
33
|
+
params[:action_date] = params[:action_date].to_s
|
34
|
+
|
32
35
|
Recorder::Sidekiq::RevisionsWorker.perform_in(
|
33
36
|
options[:delay] || 2.seconds,
|
34
|
-
|
37
|
+
params.stringify_keys
|
35
38
|
)
|
36
39
|
end
|
37
40
|
end
|
data/lib/recorder/tape.rb
CHANGED
@@ -19,19 +19,19 @@ module Recorder
|
|
19
19
|
def record_create
|
20
20
|
data = data_for(:create, recorder_options)
|
21
21
|
|
22
|
-
record(event:
|
22
|
+
record(event: 'create', data: data) if data.any?
|
23
23
|
end
|
24
24
|
|
25
25
|
def record_update
|
26
26
|
data = data_for(:update, recorder_options)
|
27
27
|
|
28
|
-
record(event:
|
28
|
+
record(event: 'update', data: data) if data.any?
|
29
29
|
end
|
30
30
|
|
31
31
|
def record_destroy
|
32
32
|
data = data_for(:destroy, recorder_options)
|
33
33
|
|
34
|
-
record(event:
|
34
|
+
record(event: 'destroy', data: data) if data.any?
|
35
35
|
end
|
36
36
|
|
37
37
|
protected
|
@@ -51,7 +51,7 @@ module Recorder
|
|
51
51
|
item_id: item.id,
|
52
52
|
**params
|
53
53
|
},
|
54
|
-
|
54
|
+
recorder_options
|
55
55
|
)
|
56
56
|
end
|
57
57
|
end
|
data/lib/recorder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recorder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Alexandrov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|