switchman 1.10.1 → 1.10.2
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
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a94b2792f84cce23eb6a12e27c9dedcc0725f81f
|
|
4
|
+
data.tar.gz: 0ba93bf24a105041150a48ac7f364183c528cc7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 685010c8f3444e089bb6f3dab279f27002a3c58bdb51981fe6afac4055d1f3eb78a8653721c030072a5ebf28cfb2c61dd88ee290b1058bf8df938f8c6d1e2e8c
|
|
7
|
+
data.tar.gz: 207b0fe9091da5765054e498a4c3433866be039c92b20c564cbcbc69a7fcd72c6a7e4ae4eedf71b10f33a1dc6470137ba26598b208ecf8bbe20efb417def9f56
|
|
File without changes
|
|
@@ -79,7 +79,13 @@ module Switchman
|
|
|
79
79
|
def define_method_original_attribute(attr_name)
|
|
80
80
|
if sharded_column?(attr_name)
|
|
81
81
|
reflection = reflection_for_integer_attribute(attr_name)
|
|
82
|
-
|
|
82
|
+
if attr_name == "id" && ::Rails.version >= '5.1.2'
|
|
83
|
+
return if self.method_defined?(:original_id)
|
|
84
|
+
owner = self
|
|
85
|
+
else
|
|
86
|
+
owner = generated_attribute_methods
|
|
87
|
+
end
|
|
88
|
+
owner.module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
83
89
|
# rename the original method to original_
|
|
84
90
|
alias_method 'original_#{attr_name}', '#{attr_name}'
|
|
85
91
|
# and replace with one that transposes the id
|
|
@@ -117,7 +123,7 @@ module Switchman
|
|
|
117
123
|
klass.extend(ClassMethods)
|
|
118
124
|
klass.attribute_method_prefix "global_", "local_", "original_"
|
|
119
125
|
end
|
|
120
|
-
|
|
126
|
+
|
|
121
127
|
# ensure that we're using the sharded attribute method
|
|
122
128
|
# and not the silly one in AR::AttributeMethods::PrimaryKey
|
|
123
129
|
def id
|
|
@@ -31,6 +31,12 @@ module Switchman
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def find_some_ordered(ids)
|
|
35
|
+
current_shard = Shard.current(klass.shard_category)
|
|
36
|
+
ids = ids.map{|id| Shard.relative_id_for(id, current_shard, current_shard)}
|
|
37
|
+
super(ids)
|
|
38
|
+
end
|
|
39
|
+
|
|
34
40
|
def find_or_instantiator_by_attributes(match, attributes, *args)
|
|
35
41
|
primary_shard.activate { super }
|
|
36
42
|
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.10.
|
|
4
|
+
version: 1.10.2
|
|
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: 2017-
|
|
13
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: railties
|
|
@@ -177,6 +177,7 @@ files:
|
|
|
177
177
|
- db/migrate/20130328212039_create_switchman_shards.rb
|
|
178
178
|
- db/migrate/20130328224244_create_default_shard.rb
|
|
179
179
|
- db/migrate/20161206323434_add_back_default_string_limits_switchman.rb
|
|
180
|
+
- db/shard_1708.sqlite3
|
|
180
181
|
- lib/switchman.rb
|
|
181
182
|
- lib/switchman/action_controller/caching.rb
|
|
182
183
|
- lib/switchman/active_record/abstract_adapter.rb
|
|
@@ -243,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
243
244
|
version: '0'
|
|
244
245
|
requirements: []
|
|
245
246
|
rubyforge_project:
|
|
246
|
-
rubygems_version: 2.
|
|
247
|
+
rubygems_version: 2.5.1
|
|
247
248
|
signing_key:
|
|
248
249
|
specification_version: 4
|
|
249
250
|
summary: Rails 4 sharding magic
|