activekit 0.1.1 → 0.1.3
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/app/models/active_kit/attribute.rb +9 -0
- data/db/migrate/20231016050208_create_active_kit_attributes.rb +9 -0
- data/lib/active_kit/activekitable.rb +15 -0
- data/lib/active_kit/engine.rb +5 -3
- data/lib/active_kit/sequence/sequenceable.rb +3 -12
- data/lib/active_kit/sequence.rb +8 -0
- data/lib/active_kit/version.rb +1 -1
- data/lib/active_kit.rb +1 -2
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf28e084bf1e87d21b36b3abcce5f3ebc902595a9635396f985c3935467e6b48
|
4
|
+
data.tar.gz: ee2abf2cd217e523b35aa980dfa84072dee883dde5a2a782f864453740448321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9848ed64694d379141ab41865234ac80f6042452be9a3a34ee2f94db61fa7a9c4e3bd564fb85c6029bd7e86379e773fc5b3945a7676ea4955489cd325a72bd4
|
7
|
+
data.tar.gz: 8724f2eb4848df56dd589ad04e241c8a95a47d27b80e2d3c7bc1838f4b02a76e726115c27c03f449699c40ca34c8f50667254b1056408dea42bf02e5aafa5bc0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
require "active_kit/sequence/sequenceable"
|
3
|
+
|
4
|
+
module ActiveKit
|
5
|
+
module Activekitable
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
include ActiveKit::Sequence::Sequenceable
|
8
|
+
|
9
|
+
included do
|
10
|
+
end
|
11
|
+
|
12
|
+
class_methods do
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/active_kit/engine.rb
CHANGED
@@ -3,11 +3,13 @@ module ActiveKit
|
|
3
3
|
isolate_namespace ActiveKit
|
4
4
|
config.eager_load_namespaces << ActiveKit
|
5
5
|
|
6
|
-
initializer "active_kit.
|
7
|
-
require "active_kit/
|
6
|
+
initializer "active_kit.activekitable" do
|
7
|
+
require "active_kit/activekitable"
|
8
8
|
|
9
9
|
ActiveSupport.on_load(:active_record) do
|
10
|
-
include ActiveKit::
|
10
|
+
include ActiveKit::Activekitable
|
11
|
+
|
12
|
+
has_one :activekit, as: :record, dependent: :destroy, class_name: "ActiveKit::Attribute"
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -24,27 +24,18 @@ module ActiveKit
|
|
24
24
|
|
25
25
|
unless self.respond_to?(:sequencer)
|
26
26
|
define_singleton_method :sequencer do
|
27
|
-
@sequencer ||=
|
27
|
+
@sequencer ||= ActiveKit::Sequence::Sequencer.new(current_class: self)
|
28
28
|
end
|
29
29
|
|
30
|
-
has_many :sequence_attributes, as: :record, dependent: :destroy, class_name: "ActiveSequence::Attribute"
|
31
30
|
# scope :order_sequence, -> (options_hash) { includes(:sequence_attributes).where(sequence_attributes: { name: name.to_s }).order("sequence_attributes.value": :asc) }
|
32
31
|
end
|
33
32
|
|
34
|
-
|
35
|
-
set_active_sequence_commit_callbacks(attribute_name: name, positioning_method: positioning_method, updater: options.delete(:updater))
|
33
|
+
set_active_sequence_callbacks(attribute_name: name, positioning_method: positioning_method, updater: options.delete(:updater))
|
36
34
|
|
37
35
|
sequencer.add_attribute(name: name, options: options)
|
38
36
|
end
|
39
37
|
|
40
|
-
def
|
41
|
-
before_create do
|
42
|
-
self.sequence_attributes.find_or_initialize_by(name: attribute_name)
|
43
|
-
logger.info "ActiveSequence - Creating Sequence attribute '#{attribute}' from #{self.class.name}: Done."
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def set_active_sequence_commit_callbacks(attribute_name:, positioning_method:, updater:)
|
38
|
+
def set_active_sequence_callbacks(attribute_name:, positioning_method:, updater:)
|
48
39
|
updater = updater || {}
|
49
40
|
|
50
41
|
if updater.empty?
|
data/lib/active_kit/version.rb
CHANGED
data/lib/active_kit.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- plainsource
|
@@ -47,10 +47,14 @@ files:
|
|
47
47
|
- app/jobs/active_kit/application_job.rb
|
48
48
|
- app/mailers/active_kit/application_mailer.rb
|
49
49
|
- app/models/active_kit/application_record.rb
|
50
|
+
- app/models/active_kit/attribute.rb
|
50
51
|
- app/views/layouts/active_kit/application.html.erb
|
51
52
|
- config/routes.rb
|
53
|
+
- db/migrate/20231016050208_create_active_kit_attributes.rb
|
52
54
|
- lib/active_kit.rb
|
55
|
+
- lib/active_kit/activekitable.rb
|
53
56
|
- lib/active_kit/engine.rb
|
57
|
+
- lib/active_kit/sequence.rb
|
54
58
|
- lib/active_kit/sequence/sequenceable.rb
|
55
59
|
- lib/active_kit/sequence/sequencer.rb
|
56
60
|
- lib/active_kit/sequence/wordbook.rb
|