undertow 0.2.1 → 0.3.0
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/undertow/dsl.rb +7 -7
- data/lib/undertow/trackable.rb +17 -0
- data/lib/undertow/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: 4f841e4e433bebfa87d5086cdf621af5ede70a74754a98031645aa6181fcc8eb
|
|
4
|
+
data.tar.gz: b138e06bb8e54eaf5c40223fc07d08b6148bdbeefc7c9cfb8512b4b23c3a7d7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d31057a9a903b49a76208fbbeca609aa43ae43dcde2bd3dc98b142118f2694bc648cf1a4ee44958a7c52c1bbd9e3a85fc160c67105748096efadd6e7fb101d0
|
|
7
|
+
data.tar.gz: ef556acc038295b60fb3083fd3c79f70537f57d773f8ec10d0ead41b7c37019cdda3e20e035e2d0c407b1a5a4bc220562dcb4bd1beb471b596f9466777e2f8e4
|
data/lib/undertow/dsl.rb
CHANGED
|
@@ -5,14 +5,14 @@ module Undertow
|
|
|
5
5
|
# that calls these methods automatically registers itself with Undertow and
|
|
6
6
|
# gets Trackable behavior wired in at boot, no include needed.
|
|
7
7
|
#
|
|
8
|
-
# class
|
|
9
|
-
# undertow_on_drain ->(model_name, ids, deleted_ids) {
|
|
10
|
-
# undertow_skip %w[
|
|
8
|
+
# class Post < ApplicationRecord
|
|
9
|
+
# undertow_on_drain ->(model_name, ids, deleted_ids) { PostSyncJob.perform_later(ids, deleted_ids) }
|
|
10
|
+
# undertow_skip %w[view_count updated_at]
|
|
11
11
|
#
|
|
12
|
-
# undertow_depends_on :
|
|
13
|
-
# undertow_depends_on :
|
|
14
|
-
# resolver: ->(
|
|
15
|
-
# watched_columns: %w[
|
|
12
|
+
# undertow_depends_on :author, foreign_key: :author_id, watched_columns: %w[name bio]
|
|
13
|
+
# undertow_depends_on :tag,
|
|
14
|
+
# resolver: ->(tag) { Post.joins(:post_tags).where(post_tags: { tag_id: tag.id }) },
|
|
15
|
+
# watched_columns: %w[name slug]
|
|
16
16
|
# end
|
|
17
17
|
#
|
|
18
18
|
module DSL
|
data/lib/undertow/trackable.rb
CHANGED
|
@@ -39,6 +39,23 @@ module Undertow
|
|
|
39
39
|
Buffer.push_deleted(name, ids)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
# Enqueues records into the pending buffer without going through AR
|
|
43
|
+
# callbacks. Use this to replay a batch through the drain handler without
|
|
44
|
+
# triggering other model lifecycle callbacks, e.g. from a console or a
|
|
45
|
+
# data migration.
|
|
46
|
+
#
|
|
47
|
+
# Post.undertow_requeue(Post.where(author_id: 123))
|
|
48
|
+
# Post.undertow_requeue([136543, 136544])
|
|
49
|
+
# Post.undertow_requeue # all records
|
|
50
|
+
def undertow_requeue(scope_or_ids = :all)
|
|
51
|
+
ids = case scope_or_ids
|
|
52
|
+
when :all then pluck(:id)
|
|
53
|
+
when ActiveRecord::Relation then scope_or_ids.pluck(:id)
|
|
54
|
+
else Array(scope_or_ids)
|
|
55
|
+
end
|
|
56
|
+
_push_undertow_pending(ids)
|
|
57
|
+
end
|
|
58
|
+
|
|
42
59
|
def _push_dep_pending(record, dep)
|
|
43
60
|
ids = _dep_ids_for(record, dep)
|
|
44
61
|
_push_undertow_pending(ids) if ids.any?
|
data/lib/undertow/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: undertow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan Allen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|