activerecord_partitioning 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,14 +4,14 @@ require 'activerecord_partitioning/connection_pools'
4
4
  module ActiveRecordPartitioning
5
5
  module_function
6
6
  def setup(key_name, default_config = nil, store = {})
7
- @default_config = default_config.try(:symbolize_keys)
7
+ self.default_config = default_config.try(:symbolize_keys)
8
8
  new_pools = ConnectionPools.new(key_name, store)
9
9
  new_pools.merge!(ActiveRecord::Base.connection_handler.connection_pools)
10
10
  ActiveRecord::Base.connection_handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new(new_pools)
11
11
  end
12
12
 
13
13
  def reset_connection_handler
14
- @default_config = nil
14
+ self.default_config = nil
15
15
  ActiveRecord::Base.connection_handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
16
16
  end
17
17
 
@@ -30,6 +30,10 @@ module ActiveRecordPartitioning
30
30
  @default_config
31
31
  end
32
32
 
33
+ def default_config=(config)
34
+ @default_config = config
35
+ end
36
+
33
37
  def current_connection_pool_config
34
38
  Thread.current[:current_connection_pool_config] || self.default_config
35
39
  end
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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Xiao Li