hoardable 0.19.5 → 0.19.6
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/lib/hoardable/database_client.rb +5 -2
- data/lib/hoardable/model.rb +4 -1
- data/lib/hoardable/version.rb +1 -1
- data/lib/hoardable/version_model.rb +5 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f0ada29a358bfb5f0fb228452d76724b72019885731a90e6c74f66d1088f797a
|
|
4
|
+
data.tar.gz: 6f9477217d44169cbcfdc0e5b0ee619ec1a44b043f396e7b7107100cc5de9e5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 469b867e63023ce187d3aec39c44f9710792c9999eb2bd45289d64d7899057c6f119cd51677ade6b916d8ab7364f20eaa6fad5ed0bd10438c6393e81730e3ec9
|
|
7
|
+
data.tar.gz: f7fe21278b35d8730d90e4c3a201778554666afa971999ada34fbc5c482eb64f3324cb4009e7afa6ac3696926f942e2f2c19099798dd71c0f7dc324156b5180d
|
|
@@ -28,8 +28,11 @@ module Hoardable
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def find_or_initialize_hoardable_event_uuid
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
contextual_event_uuid = Thread.current[:contextual_event_uuid]
|
|
32
|
+
|
|
33
|
+
return contextual_event_uuid unless contextual_event_uuid.nil?
|
|
34
|
+
|
|
35
|
+
Thread.current[:hoardable_event_uuid] ||= SecureRandom.uuid
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
def initialize_version_attributes(operation)
|
data/lib/hoardable/model.rb
CHANGED
|
@@ -9,6 +9,9 @@ module Hoardable
|
|
|
9
9
|
extend ActiveSupport::Concern
|
|
10
10
|
|
|
11
11
|
class_methods do
|
|
12
|
+
# Allows setting a custom table name for the +version+ model.
|
|
13
|
+
attr_accessor :version_table_name
|
|
14
|
+
|
|
12
15
|
# If called with a hash, this will set the model-level +Hoardable+ configuration variables. If
|
|
13
16
|
# called without an argument it will return the computed +Hoardable+ configuration considering
|
|
14
17
|
# both model-level and global values.
|
|
@@ -43,7 +46,7 @@ module Hoardable
|
|
|
43
46
|
end
|
|
44
47
|
|
|
45
48
|
private def hoardable_current_config_key
|
|
46
|
-
"hoardable_#{name}_config"
|
|
49
|
+
:"hoardable_#{name}_config"
|
|
47
50
|
end
|
|
48
51
|
end
|
|
49
52
|
|
data/lib/hoardable/version.rb
CHANGED
|
@@ -27,12 +27,13 @@ module Hoardable
|
|
|
27
27
|
# disable STI on versions tables
|
|
28
28
|
self.inheritance_column = :_
|
|
29
29
|
|
|
30
|
-
self.table_name =
|
|
30
|
+
self.table_name =
|
|
31
|
+
superclass.version_table_name || "#{table_name.singularize}#{VERSION_TABLE_SUFFIX}"
|
|
31
32
|
|
|
32
33
|
alias_method :readonly?, :persisted?
|
|
33
34
|
|
|
34
35
|
%i[operation event_uuid during].each do |symbol|
|
|
35
|
-
define_method("hoardable_#{symbol}") { public_send("_#{symbol}") }
|
|
36
|
+
define_method(:"hoardable_#{symbol}") { public_send(:"_#{symbol}") }
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
# @!scope class
|
|
@@ -105,7 +106,7 @@ module Hoardable
|
|
|
105
106
|
transaction do
|
|
106
107
|
insert_untrashed_source.tap do |untrashed|
|
|
107
108
|
untrashed
|
|
108
|
-
.send(
|
|
109
|
+
.send(:hoardable_client)
|
|
109
110
|
.insert_hoardable_version("insert") do
|
|
110
111
|
untrashed.instance_variable_set(:@hoardable_version, self)
|
|
111
112
|
untrashed.run_callbacks(:untrashed)
|
|
@@ -114,7 +115,7 @@ module Hoardable
|
|
|
114
115
|
end
|
|
115
116
|
end
|
|
116
117
|
|
|
117
|
-
DATA_KEYS.each { |key| define_method("hoardable_#{key}") { _data&.dig(key.to_s) } }
|
|
118
|
+
DATA_KEYS.each { |key| define_method(:"hoardable_#{key}") { _data&.dig(key.to_s) } }
|
|
118
119
|
|
|
119
120
|
# Returns the +ActiveRecord+
|
|
120
121
|
# {https://api.rubyonrails.org/classes/ActiveModel/Dirty.html#method-i-changes changes} that
|