activerecord_partitioning 0.0.3 → 0.0.4
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.
- data/lib/activerecord_partitioning.rb +6 -2
- metadata +3 -3
@@ -18,15 +18,19 @@ module ActiveRecordPartitioning
|
|
18
18
|
def with_connection_pool(config, &block)
|
19
19
|
self.current_connection_pool_config = config = config.symbolize_keys
|
20
20
|
if ActiveRecord::Base.connection_pool.nil?
|
21
|
-
ActiveRecord::Base.establish_connection((
|
21
|
+
ActiveRecord::Base.establish_connection((self.default_config || {}).merge(config))
|
22
22
|
end
|
23
23
|
yield if block_given?
|
24
24
|
ensure
|
25
25
|
self.current_connection_pool_config = nil
|
26
26
|
end
|
27
27
|
|
28
|
+
def default_config
|
29
|
+
@default_config
|
30
|
+
end
|
31
|
+
|
28
32
|
def current_connection_pool_config
|
29
|
-
Thread.current[:current_connection_pool_config] ||
|
33
|
+
Thread.current[:current_connection_pool_config] || self.default_config
|
30
34
|
end
|
31
35
|
|
32
36
|
def current_connection_pool_config=(config)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_partitioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Xiao Li
|