switchman 3.5.10 → 3.5.12

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: a5501276e4bb51045e5d329a0cf74776a5b13318d2253d3361073f6df18c0c9b
4
- data.tar.gz: 5a03efa22b8e2113f3c411b463a363f92282329e15e020a24f0b1c16a59ddcb5
3
+ metadata.gz: 9a18e4da75efcd07fcf8d46d08397d2323c7795f3f971a66561e03944383bf4e
4
+ data.tar.gz: 65963d628b6a011a7e29d7b76735f6d6318afec42b3359e5cd4c6f4c21e591c6
5
5
  SHA512:
6
- metadata.gz: b1bebdf8811f527233b21c2f138682dd52f165edfc0f5929c7166df1367e273431f33777aa71b7c5768762c889208caebc7df804ff0de16f2d7e34384a951f5b
7
- data.tar.gz: efd7c3efed799eb33eb0e9f1e549cd0bbbcdbc9b4713359df029bedf53c05bd2b841d557e4854e8eb19153ab42b768b2b386ce501c8174c692e10b125c28a846
6
+ metadata.gz: 278b27e999056a7b9a8bf1fbed3f4de12b110fc269410b7ffaf4c7fdcd340ef37e2af8174dd2ce499e90ab07483ee057261067224c474053707ab2de67c3c41c
7
+ data.tar.gz: 5d9aa9b061b88fe2ea62d11005eaf4db9e05c9c65da11fd6d82bdaf5ddb707507bd024b95a2b9fca1ab3b194a158fbfc8ce66e5f6b5d5f9bf9327cd121d897ba
@@ -158,7 +158,15 @@ module Switchman
158
158
  end
159
159
 
160
160
  @loaded_from_shard ||= Shard.current(self.class.connection_class_for_self)
161
- readonly! if shadow_record? && !Switchman.config[:writable_shadow_records]
161
+ if shadow_record? && !Switchman.config[:writable_shadow_records]
162
+ @readonly = true
163
+ @readonly_from_shadow ||= true
164
+ end
165
+ super
166
+ end
167
+
168
+ def readonly!
169
+ @readonly_from_shadow = false
162
170
  super
163
171
  end
164
172
 
@@ -169,6 +177,10 @@ module Switchman
169
177
  pkey > Shard::IDS_PER_SHARD
170
178
  end
171
179
 
180
+ def canonical?
181
+ !shadow_record?
182
+ end
183
+
172
184
  def save_shadow_record(new_attrs: attributes, target_shard: Shard.current)
173
185
  return if target_shard == shard
174
186
 
@@ -34,6 +34,10 @@ module Switchman
34
34
  # When a shadow record is reloaded the real record is returned. So
35
35
  # we need to ensure the loaded_from_shard is set correctly after a reload.
36
36
  @loaded_from_shard = @shard
37
+ if @readonly_from_shadow
38
+ @readonly_from_shadow = false
39
+ @readonly = false
40
+ end
37
41
  res
38
42
  end
39
43
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = "3.5.10"
4
+ VERSION = "3.5.12"
5
5
  end
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.10
4
+ version: 3.5.12
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: 2023-10-02 00:00:00.000000000 Z
13
+ date: 2023-10-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord