seamless_database_pool 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
File without changes
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  spec = Gem::Specification.new do |s|
24
24
  s.name = "seamless_database_pool"
25
- s.version = "1.0.0"
25
+ s.version = "1.0.1"
26
26
  s.author = "Brian Durand"
27
27
  s.platform = Gem::Platform::RUBY
28
28
  s.summary = "Support for master/slave database clusters in ActiveRecord"
@@ -40,4 +40,4 @@ end
40
40
 
41
41
  Rake::GemPackageTask.new(spec) do |pkg|
42
42
  pkg.need_tar = true
43
- end
43
+ end
@@ -70,7 +70,12 @@ module SeamlessDatabasePool
70
70
  end
71
71
 
72
72
  def perform_action_with_seamless_database_pool
73
- read_pool_method = session.delete(:next_request_db_connection) if session
73
+ read_pool_method = nil
74
+ if session
75
+ read_pool_method = session[:next_request_db_connection]
76
+ session[:next_request_db_connection] = nil
77
+ end
78
+
74
79
  read_pool_method ||= seamless_database_pool_options[action_name.to_sym] || seamless_database_pool_options[:all]
75
80
  if read_pool_method
76
81
  SeamlessDatabasePool.set_read_only_connection_type(read_pool_method) do
@@ -1,4 +1,5 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
+ require 'cgi'
2
3
 
3
4
  describe "SeamlessDatabasePool::ControllerFilter" do
4
5
 
@@ -6,8 +7,9 @@ describe "SeamlessDatabasePool::ControllerFilter" do
6
7
  class TestApplicationController
7
8
  attr_reader :action_name, :session
8
9
 
9
- def initialize(action, session = {})
10
+ def initialize(action, session = nil)
10
11
  @action_name = action
12
+ session ||= CGI::Session.new(CGI.new)
11
13
  @session = session
12
14
  end
13
15
 
@@ -87,7 +89,7 @@ describe "SeamlessDatabasePool::ControllerFilter" do
87
89
  end
88
90
 
89
91
  it "should be able to force using the master connection on the next request" do
90
- session = {}
92
+ session = CGI::Session.new(CGI.new)
91
93
 
92
94
  # First request
93
95
  controller = SeamlessDatabasePool::TestOtherController.new('read', session)
@@ -114,7 +116,7 @@ describe "SeamlessDatabasePool::ControllerFilter" do
114
116
  end
115
117
 
116
118
  it "should force the master connection on the next request for a redirect in master connection block" do
117
- session = {}
119
+ session = CGI::Session.new(CGI.new)
118
120
  controller = SeamlessDatabasePool::TestOtherController.new('redirect_master_action', session)
119
121
  controller.perform_action.should == {:action => :read}
120
122
 
@@ -123,7 +125,7 @@ describe "SeamlessDatabasePool::ControllerFilter" do
123
125
  end
124
126
 
125
127
  it "should not force the master connection on the next request for a redirect not in master connection block" do
126
- session = {}
128
+ session = CGI::Session.new(CGI.new)
127
129
  controller = SeamlessDatabasePool::TestOtherController.new('redirect_read_action', session)
128
130
  controller.perform_action.should == {:action => :read}
129
131
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seamless_database_pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-24 00:00:00 -05:00
12
+ date: 2008-07-25 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -23,13 +23,13 @@ extra_rdoc_files:
23
23
  - README
24
24
  files:
25
25
  - lib/active_record
26
- - lib/seamless_database_pool
27
- - lib/seamless_database_pool.rb
28
26
  - lib/active_record/connection_adapters
29
27
  - lib/active_record/connection_adapters/seamless_database_pool_adapter.rb
28
+ - lib/seamless_database_pool
30
29
  - lib/seamless_database_pool/connect_timeout.rb
31
30
  - lib/seamless_database_pool/connection_statistics.rb
32
31
  - lib/seamless_database_pool/controller_filter.rb
32
+ - lib/seamless_database_pool.rb
33
33
  - init.rb
34
34
  - MIT-LICENSE
35
35
  - Rakefile
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - rspec 1.0.8 or higher is needed to run the tests
63
63
  rubyforge_project: seamlessdbpool
64
- rubygems_version: 1.0.1
64
+ rubygems_version: 1.2.0
65
65
  signing_key:
66
66
  specification_version: 2
67
67
  summary: Support for master/slave database clusters in ActiveRecord