connection_manager 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -52,6 +52,7 @@ module ConnectionManager
|
|
52
52
|
klass = Class.new(ActiveRecord::Base)
|
53
53
|
new_connection_class = Object.const_set(class_name, klass)
|
54
54
|
new_connection_class.establish_managed_connection(connection_key)
|
55
|
+
new_connection_class.table_name_prefix = "#{new_connection_class.database_name}."
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
@@ -39,7 +39,7 @@ module ConnectionManager
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def table_name_for_dup(con_class)
|
42
|
-
"#{con_class
|
42
|
+
"#{table_name_prefix_for_dup(con_class)}#{table_name.split('.').last}"
|
43
43
|
end
|
44
44
|
|
45
45
|
def table_name_prefix_for_dup(con_class)
|
@@ -51,7 +51,7 @@ describe ConnectionManager::Replication do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
context "the objects return from a query" do
|
54
|
-
# The default connection is the
|
54
|
+
# The default connection is the original connection for the model
|
55
55
|
it "should have the connection as the replication" do
|
56
56
|
Fruit.replicated
|
57
57
|
FactoryGirl.create(:fruit)
|
@@ -106,7 +106,7 @@ describe ConnectionManager::Replication do
|
|
106
106
|
@foo.save
|
107
107
|
end
|
108
108
|
|
109
|
-
# We'd like this to
|
109
|
+
# We'd like this to happen magically some day. Possible in 3.2
|
110
110
|
it "should eager load with replication instances" do
|
111
111
|
user = User.includes(:foos).slaves.where(:id => @user.id).first
|
112
112
|
user.foos.first.should_not be_kind_of(Foo)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: connection_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|