switchman 3.5.15 → 3.5.17
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4be6b901fa539e03de36e75c6af7411f52b8f06cf244e1b88256cab14fd1b200
|
4
|
+
data.tar.gz: cc542e6d038988551e9a05a3bef165410243b8f096b1ebfdd2a2f3c9250c602d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b3d5610bde72b9be796c0641c844a5e2ad73f10e359fd6a9302d0046f51c300e61182e853392e7c7f36ef9631887c64368edd88be5510b15e5b3f9f77fe8685
|
7
|
+
data.tar.gz: ee6fbaec2c858ec528cdab51ec88b442aa36137347312fa53e0391f4dee8491e03b37226d12d660eb16e7aa4f20a706d914e66e096e016b7706ca1c72f3834a1
|
@@ -331,7 +331,15 @@ module Switchman
|
|
331
331
|
primary_key_foreign_key_pairs = primary_key.zip(foreign_key)
|
332
332
|
primary_key_foreign_key_pairs.each do |pk, fk|
|
333
333
|
# Notable change: add relative_id_for here
|
334
|
-
association_id =
|
334
|
+
association_id = if record.class.sharded_column?(pk)
|
335
|
+
Shard.relative_id_for(
|
336
|
+
record._read_attribute(pk),
|
337
|
+
record.shard,
|
338
|
+
shard
|
339
|
+
)
|
340
|
+
else
|
341
|
+
record._read_attribute(pk)
|
342
|
+
end
|
335
343
|
self[fk] = association_id unless self[fk] == association_id
|
336
344
|
end
|
337
345
|
association.loaded!
|
@@ -153,6 +153,8 @@ module Switchman
|
|
153
153
|
|
154
154
|
def self.prepended(klass)
|
155
155
|
klass.singleton_class.prepend(ClassMethods)
|
156
|
+
klass.scope :non_shadow, ->(key = primary_key) { where("#{key}<=? AND #{key}>?", Shard::IDS_PER_SHARD, 0) }
|
157
|
+
klass.scope :shadow, ->(key = primary_key) { where("#{key}>?", Shard::IDS_PER_SHARD) }
|
156
158
|
end
|
157
159
|
|
158
160
|
def _run_initialize_callbacks
|
data/lib/switchman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-01-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|