switchman 3.5.18 → 3.5.20
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88d7a6f4e778e781d7706281f5330b378a7f7982fe7475a95b76693c1549d146
|
4
|
+
data.tar.gz: e8ebfc94e5a57a56a5a44f2924d3f273fd5424211ead5def892c19d5fca0ba7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 983b75007895318e8e1dda6022f755c923e3b6d390ce9112037eb202be9384caaa7f7fd9e633c1e200f75bbd5a2346f9871cd60aed71f1b7b7b5a04f6aa63906
|
7
|
+
data.tar.gz: c91f50e916dc069b75fc8260c1ae52cd64e132e8eb68bb22c182a4291b87bf9a03bea390c8797b50b7b477fc7c82af8670b99e0213e4c5b712e097295912d98c
|
@@ -291,14 +291,14 @@ module Switchman
|
|
291
291
|
end
|
292
292
|
|
293
293
|
module AutosaveAssociation
|
294
|
-
|
295
|
-
|
294
|
+
if ::Rails.version < "7.1"
|
295
|
+
def association_foreign_key_changed?(reflection, record, key)
|
296
|
+
return false if reflection.through_reflection?
|
296
297
|
|
297
|
-
|
298
|
-
|
299
|
-
|
298
|
+
# have to use send instead of _read_attribute because sharding
|
299
|
+
record.has_attribute?(reflection.foreign_key) && record.send(reflection.foreign_key) != key
|
300
|
+
end
|
300
301
|
|
301
|
-
if ::Rails.version < "7.1"
|
302
302
|
def save_belongs_to_association(reflection)
|
303
303
|
# this seems counter-intuitive, but the autosave code will assign to attribute bypassing switchman,
|
304
304
|
# after reading the id attribute _without_ bypassing switchman. So we need Shard.current for the
|
@@ -306,6 +306,16 @@ module Switchman
|
|
306
306
|
shard.activate(connection_class_for_self_for_reflection(reflection)) { super }
|
307
307
|
end
|
308
308
|
else
|
309
|
+
def association_foreign_key_changed?(reflection, record, key)
|
310
|
+
return false if reflection.through_reflection?
|
311
|
+
|
312
|
+
foreign_key = Array(reflection.foreign_key)
|
313
|
+
return false unless foreign_key.all? { |k| record._has_attribute?(k) }
|
314
|
+
|
315
|
+
# have to use send instead of _read_attribute because sharding
|
316
|
+
foreign_key.map { |k| record.send(k) } != Array(key)
|
317
|
+
end
|
318
|
+
|
309
319
|
def save_belongs_to_association(reflection)
|
310
320
|
association = association_instance_get(reflection.name)
|
311
321
|
return unless association&.loaded? && !association.stale_target?
|
@@ -277,7 +277,7 @@ module Switchman
|
|
277
277
|
end
|
278
278
|
|
279
279
|
reflection = self.class.send(:reflection_for_integer_attribute, attr_name)
|
280
|
-
super(::Switchman::Shard.relative_id_for(
|
280
|
+
super(attr_name, ::Switchman::Shard.relative_id_for(
|
281
281
|
new_value,
|
282
282
|
::Switchman::Shard.current(connection_class_for_self_for_reflection(reflection)),
|
283
283
|
shard
|
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.20
|
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: 2024-
|
13
|
+
date: 2024-02-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -288,6 +288,7 @@ licenses:
|
|
288
288
|
- MIT
|
289
289
|
metadata:
|
290
290
|
rubygems_mfa_required: 'true'
|
291
|
+
source_code_uri: https://github.com/instructure/switchman
|
291
292
|
post_install_message:
|
292
293
|
rdoc_options: []
|
293
294
|
require_paths:
|