decisiv-sharded_database 0.3.2.1 → 0.3.3.1

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.
@@ -6,6 +6,6 @@ require 'sharded_database/core_extensions'
6
6
 
7
7
  module ShardedDatabase
8
8
 
9
- VERSION = '0.3.2'
9
+ VERSION = '0.3.3'
10
10
 
11
11
  end
@@ -3,12 +3,11 @@ module ShardedDatabase
3
3
 
4
4
  def self.included(klass)
5
5
  klass.class_eval do
6
- alias_method_chain :initialize, :connection
7
- #alias_method_chain :find, :connection
6
+ alias_method_chain :initialize, :delegated_connection
8
7
  end
9
8
  end
10
9
 
11
- def initialize_with_connection(owner, reflection)
10
+ def initialize_with_delegated_connection(owner, reflection)
12
11
  if @connection_class = reflection.options[:connection_class]
13
12
  @original_class = reflection.klass
14
13
  reflection.metaclass.class_eval %{
@@ -17,21 +16,10 @@ module ShardedDatabase
17
16
  end
18
17
  }
19
18
  end
20
- initialize_without_connection(owner, reflection)
21
- end
22
-
23
- def find_with_connection(*args)
24
- if connection_class = @reflection.options[:connection_class]
25
- ShardedDatabase::ModelWithConnection.borrow_connection(@reflection.klass, connection_class) do
26
- find_without_connection(*args)
27
- end
28
- else
29
- find_without_connection(*args)
30
- end
19
+ initialize_without_delegated_connection(owner, reflection)
31
20
  end
32
21
 
33
22
  end
34
23
  end
35
24
 
36
- ActiveRecord::Associations::HasManyAssociation.send :include, ShardedDatabase::HasManyAssociation
37
- ActiveRecord::Associations::HasManyThroughAssociation.send :include, ShardedDatabase::HasManyAssociation
25
+ ActiveRecord::Associations::HasManyAssociation.send :include, ShardedDatabase::HasManyAssociation
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decisiv-sharded_database
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2.1
4
+ version: 0.3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brennan Dunn