journaled 1.0.1 → 2.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/journaled/change_writer.rb +12 -8
- data/lib/journaled/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ee54a77497db5d43b3932d6015b18b6b2c4ae45
|
4
|
+
data.tar.gz: 6fc6bed161faf09676c7578531eb563a47ee9e6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030301523134d5a36c15de4e7096917c9d948c00c1514c41c9e82ff0184f358f9c346786e9f1757d229c0050073f996b03ff2bac038a7a773a9f9c02bd56bd5a
|
7
|
+
data.tar.gz: a6d3c21d82902e96f3486b3637365b20d0803a11ece98260121bc80b73555bf823b3eaf6731ba82daa8c83e6044f815793e4c5d73c996d8606eed7f0dec85f5a
|
@@ -16,11 +16,11 @@ class Journaled::ChangeWriter
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def update
|
19
|
-
journaled_change_for("update",
|
19
|
+
journaled_change_for("update", relevant_changed_attributes).journal! if relevant_changed_attributes.present?
|
20
20
|
end
|
21
21
|
|
22
22
|
def delete
|
23
|
-
journaled_change_for("delete",
|
23
|
+
journaled_change_for("delete", relevant_unperturbed_attributes).journal!
|
24
24
|
end
|
25
25
|
|
26
26
|
def journaled_change_for(database_operation, changes)
|
@@ -39,10 +39,12 @@ class Journaled::ChangeWriter
|
|
39
39
|
model.attributes.slice(*attribute_names)
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
def relevant_unperturbed_attributes
|
43
|
+
model.attributes.merge(pluck_changed_values(model.changes, index: 0)).slice(*attribute_names)
|
44
|
+
end
|
45
|
+
|
46
|
+
def relevant_changed_attributes
|
47
|
+
pluck_changed_values(model.saved_changes.slice(*attribute_names), index: 1)
|
46
48
|
end
|
47
49
|
|
48
50
|
def actor_uri
|
@@ -67,8 +69,10 @@ class Journaled::ChangeWriter
|
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
70
|
-
def
|
71
|
-
|
72
|
+
def pluck_changed_values(change_hash, index:)
|
73
|
+
change_hash.each_with_object({}) do |(k, v), result|
|
74
|
+
result[k] = v[index]
|
75
|
+
end
|
72
76
|
end
|
73
77
|
|
74
78
|
def journaled_app_name
|
data/lib/journaled/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: journaled
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.alpha1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Lipson
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-02-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: aws-sdk-resources
|
@@ -228,9 +228,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
230
|
requirements:
|
231
|
-
- - "
|
231
|
+
- - ">"
|
232
232
|
- !ruby/object:Gem::Version
|
233
|
-
version:
|
233
|
+
version: 1.3.1
|
234
234
|
requirements: []
|
235
235
|
rubyforge_project:
|
236
236
|
rubygems_version: 2.5.1
|