dm-master-slave-adapter 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -83,13 +83,12 @@ with:
|
|
83
83
|
DataMapper.repository(:default).adapter.reset_binding
|
84
84
|
|
85
85
|
In a web application, you'll typically want to reset the binding to master at the end
|
86
|
-
of each request, to ensure subsquent requests are not permanently bound to the master.
|
87
|
-
|
88
|
-
|
89
|
-
a Rails application, is to mount it inside your ApplicationController:
|
86
|
+
of each request, to ensure subsquent requests are not permanently bound to the master. A
|
87
|
+
Rack middleware is provided to do this automatically. The easiest way to use this in a
|
88
|
+
Rails application, is to mount it inside your ApplicationController:
|
90
89
|
|
91
90
|
class ApplicationController < ActionController::Base
|
92
|
-
use DataMapper::MasterSlaveAdapter::
|
91
|
+
use DataMapper::MasterSlaveAdapter::Middleware::WriteUnbinding, :default
|
93
92
|
end
|
94
93
|
|
95
94
|
You can use the middleware anywhere a Rack middleware can be used, however, but it must
|
@@ -53,6 +53,17 @@ describe DataMapper::Adapters::MasterSlaveAdapter do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
describe "#kind_of?" do
|
57
|
+
it "returns true if kind matches itself" do
|
58
|
+
@adapter.kind_of?(DataMapper::Adapters::MasterSlaveAdapter).should be_true
|
59
|
+
end
|
60
|
+
|
61
|
+
it "delegates to the master if kind does not match itself" do
|
62
|
+
@master.should_receive(:kind_of?).with(String).and_return(false)
|
63
|
+
@adapter.kind_of?(String).should be_false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
56
67
|
describe "state" do
|
57
68
|
it "allows binding reads to the master" do
|
58
69
|
@adapter.bind_to_master
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-master-slave-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-01 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &10139680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *10139680
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: dm-core
|
27
|
-
requirement: &
|
27
|
+
requirement: &10138720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *10138720
|
36
36
|
description: ! " Provides the ability to use DataMapper in an environment where\n
|
37
37
|
\ database replication draws the need for using separate connections\n for
|
38
38
|
reading and writing data.\n\n This adapter simply wraps two other \"real\" DataMapper
|