active_record_shards 2.7.4 → 2.7.5
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.
@@ -98,6 +98,7 @@ module ActiveRecordShards
|
|
98
98
|
module ActiveRelationPatches
|
99
99
|
def self.included(base)
|
100
100
|
base.send :alias_method_chain, :calculate, :default_slave
|
101
|
+
base.send :alias_method_chain, :exists?, :default_slave
|
101
102
|
end
|
102
103
|
|
103
104
|
def on_slave_unless_tx
|
@@ -107,6 +108,10 @@ module ActiveRecordShards
|
|
107
108
|
def calculate_with_default_slave(*args, &block)
|
108
109
|
on_slave_unless_tx { calculate_without_default_slave(*args, &block) }
|
109
110
|
end
|
111
|
+
|
112
|
+
def exists_with_default_slave?(*args, &block)
|
113
|
+
on_slave_unless_tx { exists_without_default_slave?(*args, &block) }
|
114
|
+
end
|
110
115
|
end
|
111
116
|
end
|
112
117
|
end
|
@@ -410,6 +410,14 @@ describe "connection switching" do
|
|
410
410
|
end
|
411
411
|
end
|
412
412
|
|
413
|
+
it "does exists? on the slave with a named scope" do
|
414
|
+
AccountThing.on_slave_by_default = true
|
415
|
+
Account.on_slave.connection.execute("INSERT INTO account_things (id, account_id) VALUES(123125, 1000)")
|
416
|
+
assert AccountThing.enabled.exists?(123125)
|
417
|
+
Account.on_slave.connection.execute("DELETE FROM account_things")
|
418
|
+
AccountThing.on_slave_by_default = false
|
419
|
+
end
|
420
|
+
|
413
421
|
it "count associations on the slave" do
|
414
422
|
AccountThing.on_slave_by_default = true
|
415
423
|
Account.on_slave.connection.execute("INSERT INTO account_things (id, account_id) VALUES(123123, 1000)")
|
data/test/models.rb
CHANGED
data/test/schema.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_shards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activerecord
|
@@ -81,12 +81,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- - ! '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
hash: 1623971940010890811
|
84
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
88
|
none: false
|
86
89
|
requirements:
|
87
90
|
- - ! '>='
|
88
91
|
- !ruby/object:Gem::Version
|
89
92
|
version: '0'
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
hash: 1623971940010890811
|
90
96
|
requirements: []
|
91
97
|
rubyforge_project:
|
92
98
|
rubygems_version: 1.8.25
|
@@ -106,4 +112,3 @@ test_files:
|
|
106
112
|
- test/migrator_test.rb
|
107
113
|
- test/models.rb
|
108
114
|
- test/schema.rb
|
109
|
-
has_rdoc:
|