activekit 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_kit/sequence/sequence.rb +4 -3
- data/lib/active_kit/sequence/sequenceable.rb +5 -2
- data/lib/active_kit/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: 67eb8f62ef1b3e4f6532c5431730922130158646b4067ed14511314777d18448
|
4
|
+
data.tar.gz: 11d7429b7011c2aca230935789489c4ac6828ff60e4cb250fe18910fd14d2daf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63885175b26d2bace31dd3ded154ab4631819645f4c2cc41653e57179968f03149f2f352c399c9693bb69bbc476e322f3c7ef67e9e4f159e956111bc478fde7c
|
7
|
+
data.tar.gz: fdd159ca5f30a970452036b5d8fd8eb384466dc908c166b7873144a2cee0f3c6cd8b671b23813db22073b389dbb916469576c8eef3cd0a44d1ca80e844507372
|
@@ -18,11 +18,12 @@ module ActiveKit
|
|
18
18
|
|
19
19
|
wordbook = Wordbook.new
|
20
20
|
word_for_position = wordbook.next_word(count: position)
|
21
|
-
|
22
|
-
|
21
|
+
# TODO: committer record for the attribute with given word_for_position should be found and resaved to recalculate its position.
|
22
|
+
# json_where = 'value->"$.sequence.attributes.' + attribute_name.to_s + '" = "' + word_for_position + '"'
|
23
|
+
# record_at_position = ActiveKit::Attribute.where(record_type: record.class.name).where(json_where).first&.record
|
23
24
|
record.activekit_association.sequence[:attributes][attribute_name.to_sym] = word_for_position
|
24
25
|
record.activekit_association.save!
|
25
|
-
record_at_position.save! if record_at_position
|
26
|
+
# record_at_position.save! if record_at_position
|
26
27
|
else
|
27
28
|
record.activekit_association.sequence[:attributes][attribute_name.to_sym] = nil
|
28
29
|
record.activekit_association.save!
|
@@ -33,7 +33,7 @@ module ActiveKit
|
|
33
33
|
updater = options.dig(:updater) || {}
|
34
34
|
|
35
35
|
if updater.empty?
|
36
|
-
|
36
|
+
after_save do
|
37
37
|
position = positioning_method ? self.public_send(positioning_method) : nil
|
38
38
|
self.class.activekiter.sequence.update(record: self, attribute_name: attribute_name, position: position)
|
39
39
|
logger.info "ActiveSequence - Sequencing from #{self.class.name}: Done."
|
@@ -49,7 +49,10 @@ module ActiveKit
|
|
49
49
|
base_klass = search_base_klass(self.name, updater_via)
|
50
50
|
klass = reflected_klass(base_klass, updater_on.keys.first)
|
51
51
|
klass.constantize.class_eval do
|
52
|
-
|
52
|
+
after_save :activekit_sequence_sequenceable_callback
|
53
|
+
after_destroy :activekit_sequence_sequenceable_callback
|
54
|
+
|
55
|
+
private def activekit_sequence_sequenceable_callback
|
53
56
|
inverse_assoc = self.class.search_inverse_assoc(self, updater_on)
|
54
57
|
position = positioning_method ? self.public_send(positioning_method) : nil
|
55
58
|
if inverse_assoc.respond_to?(:each)
|
data/lib/active_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- plainsource
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|