activerecord_partitioning 0.0.8 → 0.0.9

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.
@@ -37,6 +37,6 @@ module ActiveRecordPartitioning
37
37
  end
38
38
 
39
39
  def current_connection_pool_config
40
- Thread.current[:current_connection_pool_config] || self.default_config
40
+ Thread.current[:current_connection_pool_config]
41
41
  end
42
42
  end
@@ -20,8 +20,15 @@ module ActiveRecordPartitioning
20
20
 
21
21
  def [](klass_name)
22
22
  config = ActiveRecordPartitioning.current_connection_pool_config
23
- raise NoActiveConnectionPoolError if config.nil?
24
- @store[connection_pool_key(config)]
23
+ if config.nil?
24
+ if size == 1
25
+ values.first
26
+ else
27
+ raise NoActiveConnectionPoolError
28
+ end
29
+ else
30
+ @store[connection_pool_key(config)]
31
+ end
25
32
  end
26
33
 
27
34
  def []=(klass_name, pool)
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: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Xiao Li
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-10-11 00:00:00 Z
19
+ date: 2013-10-12 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activerecord