switchman 3.5.20 → 3.5.21

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: 88d7a6f4e778e781d7706281f5330b378a7f7982fe7475a95b76693c1549d146
4
- data.tar.gz: e8ebfc94e5a57a56a5a44f2924d3f273fd5424211ead5def892c19d5fca0ba7b
3
+ metadata.gz: 1aea9491a7cf89144f7952499f7194d6a5e975959298300c308e7ff7d5d23137
4
+ data.tar.gz: 62d4da92da4c56faa42681cfeed6f41d41a0dd004ded08501093036167d7f0c7
5
5
  SHA512:
6
- metadata.gz: 983b75007895318e8e1dda6022f755c923e3b6d390ce9112037eb202be9384caaa7f7fd9e633c1e200f75bbd5a2346f9871cd60aed71f1b7b7b5a04f6aa63906
7
- data.tar.gz: c91f50e916dc069b75fc8260c1ae52cd64e132e8eb68bb22c182a4291b87bf9a03bea390c8797b50b7b477fc7c82af8670b99e0213e4c5b712e097295912d98c
6
+ metadata.gz: b53e691f7bb0f31814133f17d0344538e193e13559bb5ffc2c9355dd5cadab146341f750d0588daf0c38b33c1a65be866ef3064f0162365050c0a875a48bf4ea
7
+ data.tar.gz: 43eec8da243a69a386e3873208ac1d7d511ac703c44fce3c4bbb0c8efc000d59aafc9b9112c2874de8aaf698c5c4590bda5af48345d35d669422a794c93386f8
@@ -106,6 +106,45 @@ module Switchman
106
106
  compact_grouped_calculation_rows(rows, opts)
107
107
  end
108
108
 
109
+ if ::Rails.version >= "7.1"
110
+ def ids
111
+ return super unless klass.sharded_primary_key?
112
+
113
+ if loaded?
114
+ result = records.map do |record|
115
+ Shard.relative_id_for(record._read_attribute(primary_key),
116
+ record.shard,
117
+ Shard.current(klass.connection_class_for_self))
118
+ end
119
+ return @async ? Promise::Complete.new(result) : result
120
+ end
121
+
122
+ if has_include?(primary_key)
123
+ relation = apply_join_dependency.group(primary_key)
124
+ return relation.ids
125
+ end
126
+
127
+ columns = arel_columns([primary_key])
128
+ base_shard = Shard.current(klass.connection_class_for_self)
129
+ activate do |r|
130
+ relation = r.spawn
131
+ relation.select_values = columns
132
+
133
+ result = if relation.where_clause.contradiction?
134
+ ActiveRecord::Result.empty
135
+ else
136
+ skip_query_cache_if_necessary do
137
+ klass.connection.select_all(relation, "#{klass.name} Ids", async: @async)
138
+ end
139
+ end
140
+
141
+ result.then do |res|
142
+ type_cast_pluck_values(res, columns).map { |id| Shard.relative_id_for(id, Shard.current, base_shard) }
143
+ end
144
+ end
145
+ end
146
+ end
147
+
109
148
  private
110
149
 
111
150
  def type_cast_calculated_value_switchman(value, column_name, operation)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = "3.5.20"
4
+ VERSION = "3.5.21"
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.20
4
+ version: 3.5.21
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-02-23 00:00:00.000000000 Z
13
+ date: 2024-02-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord