db-charmer 1.6.18 → 1.6.19
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +1 -1
- data/VERSION +1 -1
- data/db-charmer.gemspec +1 -1
- data/lib/db_charmer/sharding/stub_connection.rb +6 -5
- metadata +3 -3
data/CHANGES
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.19
|
data/db-charmer.gemspec
CHANGED
@@ -23,13 +23,14 @@ module DbCharmer
|
|
23
23
|
return @real_conn if @real_conn
|
24
24
|
|
25
25
|
# If sharded connection supports shards enumeration, get the first shard
|
26
|
-
|
26
|
+
conn = sharded_connection.shard_connections.try(:first)
|
27
27
|
|
28
28
|
# If we do not have real connection yet, try to use the default one (if it is supported by the sharder)
|
29
|
-
|
29
|
+
conn ||= sharded_connection.sharder.shard_for_key(:default) if sharded_connection.support_default_shard?
|
30
30
|
|
31
31
|
# Get connection proxy for our real connection
|
32
|
-
|
32
|
+
return nil unless conn
|
33
|
+
@real_conn = ActiveRecord::Base.coerce_to_connection_proxy(conn, DbCharmer.connections_should_exist?)
|
33
34
|
end
|
34
35
|
|
35
36
|
def method_missing(meth, *args, &block)
|
@@ -39,12 +40,12 @@ module DbCharmer
|
|
39
40
|
end
|
40
41
|
|
41
42
|
# Fail if no connection has been established yet
|
42
|
-
unless
|
43
|
+
unless real_connection
|
43
44
|
raise ActiveRecord::ConnectionNotEstablished, "No real connection to proxy this method to!"
|
44
45
|
end
|
45
46
|
|
46
47
|
# Proxy the call to our real connection target
|
47
|
-
|
48
|
+
real_connection.__send__(meth, *args, &block)
|
48
49
|
end
|
49
50
|
end
|
50
51
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db-charmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 41
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 1.6.
|
9
|
+
- 19
|
10
|
+
version: 1.6.19
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alexey Kovyrin
|