switchman 1.5.11 → 1.5.13
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c25757a3ecb19cfba0a82adbe3fa0e881d58c302
|
4
|
+
data.tar.gz: 13b9c2b34b8f9f562b84a19bb43865436e4bdff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0382c38297c9ef9cb15622fbaf342870942b660d1be4131ad085f2d891f6d38e79f5c584aba8866306f18a813703beaeafe675685f483fa75aae9de1cb1d35db
|
7
|
+
data.tar.gz: 03a4c27d1596eac4ced134b60abe9a2d05970a74d89c0040b8fdb3bacd4999e785c4f3d6ee14e9aa55943dfe6574d3c725b5a3b0be2c9f8d98080133de3fc2f7
|
@@ -46,6 +46,19 @@ module Switchman
|
|
46
46
|
# moved to WhereClauseFactory#build in Rails 5
|
47
47
|
def build_where(opts, other = [])
|
48
48
|
case opts
|
49
|
+
when String, Array
|
50
|
+
values = Hash === other.first ? other.first.values : other
|
51
|
+
|
52
|
+
values.grep(ActiveRecord::Relation) do |rel|
|
53
|
+
# serialize subqueries against the same shard as the outer query is currently
|
54
|
+
# targeted to run against
|
55
|
+
if rel.shard_source_value == :implicit && rel.primary_shard != primary_shard
|
56
|
+
rel.shard!(primary_shard)
|
57
|
+
end
|
58
|
+
self.bind_values += rel.bind_values if ::Rails.version < '4.2'
|
59
|
+
end
|
60
|
+
|
61
|
+
[@klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
|
49
62
|
when Hash, ::Arel::Nodes::Node
|
50
63
|
predicates = super
|
51
64
|
infer_shards_from_primary_key(predicates) if shard_source_value == :implicit && shard_value.is_a?(Shard)
|
@@ -5,15 +5,27 @@ module Switchman
|
|
5
5
|
|
6
6
|
def build(opts, other = [])
|
7
7
|
case opts
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
when String, Array
|
9
|
+
values = Hash === other.first ? other.first.values : other
|
10
|
+
|
11
|
+
values.grep(ActiveRecord::Relation) do |rel|
|
12
|
+
# serialize subqueries against the same shard as the outer query is currently
|
13
|
+
# targeted to run against
|
14
|
+
if rel.shard_source_value == :implicit && rel.primary_shard != @scope.primary_shard
|
15
|
+
rel.shard!(@scope.primary_shard)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
super
|
20
|
+
when Hash, ::Arel::Nodes::Node
|
21
|
+
where_clause = super
|
22
|
+
predicates = where_clause.send(:predicates)
|
23
|
+
@scope.send(:infer_shards_from_primary_key, predicates, where_clause.binds) if @scope.shard_source_value == :implicit && @scope.shard_value.is_a?(Shard)
|
24
|
+
predicates = @scope.transpose_predicates(predicates, nil, @scope.primary_shard, false, where_clause.binds) if @scope.shard_source_value != :explicit
|
25
|
+
where_clause.instance_variable_set(:@predicates, predicates)
|
26
|
+
where_clause
|
27
|
+
else
|
28
|
+
super
|
17
29
|
end
|
18
30
|
end
|
19
31
|
end
|
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: 1.5.
|
4
|
+
version: 1.5.13
|
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: 2016-06-
|
13
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|