decisiv-sharded_database 0.1.1 → 0.1.2
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/sharded_database/aggregate.rb +3 -2
- metadata +1 -1
@@ -7,8 +7,9 @@ module ShardedDatabase
|
|
7
7
|
klass.extend ClassMethods
|
8
8
|
klass.send :include, InstanceMethods
|
9
9
|
klass.class_eval do
|
10
|
-
cattr_accessor :connection_field, :source_class
|
10
|
+
cattr_accessor :connection_field, :source_class, :foreign_id
|
11
11
|
@connection_field = :oem
|
12
|
+
@foreign_id = :foreign_id
|
12
13
|
|
13
14
|
class << self
|
14
15
|
alias_method_chain :find, :raw
|
@@ -34,7 +35,7 @@ module ShardedDatabase
|
|
34
35
|
def after_find
|
35
36
|
@klass = determine_connection || raise(ShardedDatabase::NoConnectionError, 'Cannot determine connection class')
|
36
37
|
@connection = @klass.respond_to?(:connection) ? @klass.connection : raise(ShardedDatabase::NoConnectionError, 'Connection class does not respond to :connection')
|
37
|
-
@foreign_id = foreign_id
|
38
|
+
@foreign_id = self[self.class.foreign_id.to_sym]
|
38
39
|
|
39
40
|
metaclass.delegate :connection, :to => @klass
|
40
41
|
|