switchman 1.14.2 → 1.14.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f5836ec714370d9fabf7f96cd9531d19d2f52c0b210d28939982f61dd6b8710
4
- data.tar.gz: 1147a2aca07d28467d043ab6e92feba021ee5efdc2bae136bcfab8a86d029e02
3
+ metadata.gz: afdf70e3dff70e6483a536a509b202ce19dc22b3ac6a1eadb3af049d40f6482e
4
+ data.tar.gz: f8fd04a1f0db484b5673a3c17c981505199b3c31d9863d6903e495d60e8524d9
5
5
  SHA512:
6
- metadata.gz: da283413ed625b3bfb845828c77b8ceb99beabe8742be7c02d3146bd4408ea938e6c3a7d92f59722156f2612cd9e6b296a24a9ae85bebac9970d54948c9ce0e5
7
- data.tar.gz: 40a99fd5ab621441b112ebf16a4a7a06d0ce7d0af4b21ccfd1fc919f190b98b460c6d29bf061f81d8824dfa5c0dfa8c715adb72afe70951689190602820eed98
6
+ metadata.gz: 4d4abe787ed871ea4df97ae1d548f3f0fe9f669c3a61300cb78a4ead6c23e217f95413d86d4704645240ae2d9c15a6f1ada2c7100904fd600f5ec710140df69e
7
+ data.tar.gz: 5170eafe6bb1f4f99b9613eab34eadcc7b5767dd2f686d4885d6a0965241982a2c717d434af6962d60e2e9f9e664e7673b38dbda46f6b79ac103802b77883e50
@@ -153,9 +153,12 @@ module Switchman
153
153
  def shard_category_for_reflection(reflection)
154
154
  if reflection
155
155
  if reflection.options[:polymorphic]
156
- # a polymorphic association has to be discovered at runtime. This code ends up being something like
157
- # context_type.&.constantize&.shard_category || :primary
158
- read_attribute(reflection.foreign_type)&.constantize&.shard_category || :primary
156
+ begin
157
+ read_attribute(reflection.foreign_type)&.constantize&.shard_category || :primary
158
+ rescue NameError
159
+ # in case someone is abusing foreign_type to not point to an actual class
160
+ :primary
161
+ end
159
162
  else
160
163
  # otherwise we can just return a symbol for the statically known type of the association
161
164
  reflection.klass.shard_category
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.14.2"
2
+ VERSION = "1.14.3"
3
3
  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: 1.14.2
4
+ version: 1.14.3
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: 2019-07-30 00:00:00.000000000 Z
13
+ date: 2019-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties