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.
@@ -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
 
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brennan Dunn