Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for SqlBypass session store (for master) #2042

Merged
merged 1 commit into from

2 participants

@jhtwong

Fix for SqlBypass session store - for master, see #2040, #2016

Two issues fixed:
1) connection_pool is not defined - needed by SessionStore#drop_table!
and create_table! since c94651f

2) initialization of connection to the default of AR::Base.connection
only occurred at the singleton level - the instance level method defined
by cattr_accessor did not have this logic

@jhtwong jhtwong Fix for SqlBypass session store
Two issues fixed:
1) connection_pool is not defined - needed by SessionStore#drop_table!
and create_table! since c94651f

2) initialization of connection to the default of AR::Base.connection
only occurred at the singleton level - the instance level method defined
by cattr_accessor did not have this logic
88e6c06
@spastorino spastorino merged commit 8cf4515 into rails:master
@spastorino spastorino merged commit 88e6c06 into rails:master
@spastorino spastorino closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 12, 2011
  1. @jhtwong

    Fix for SqlBypass session store

    jhtwong authored
    Two issues fixed:
    1) connection_pool is not defined - needed by SessionStore#drop_table!
    and create_table! since c94651f
    
    2) initialization of connection to the default of AR::Base.connection
    only occurred at the singleton level - the instance level method defined
    by cattr_accessor did not have this logic
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 7 deletions.
  1. +13 −7 activerecord/lib/active_record/session_store.rb
View
20 activerecord/lib/active_record/session_store.rb
@@ -183,11 +183,6 @@ class SqlBypass
##
# :singleton-method:
- # Use the ActiveRecord::Base.connection by default.
- cattr_accessor :connection
-
- ##
- # :singleton-method:
# The table name defaults to 'sessions'.
cattr_accessor :table_name
@@table_name = 'sessions'
@@ -206,10 +201,19 @@ class SqlBypass
class << self
alias :data_column_name :data_column
+
+ # Use the ActiveRecord::Base.connection by default.
+ attr_writer :connection
+
+ # Use the ActiveRecord::Base.connection_pool by default.
+ attr_writer :connection_pool
- remove_method :connection
def connection
- @@connection ||= ActiveRecord::Base.connection
+ @connection ||= ActiveRecord::Base.connection
+ end
+
+ def connection_pool
+ @connection_pool ||= ActiveRecord::Base.connection_pool
end
# Look up a session by id and unmarshal its data if found.
@@ -219,6 +223,8 @@ def find_by_session_id(session_id)
end
end
end
+
+ delegate :connection, :connection=, :connection_pool, :connection_pool=, :to => self
attr_reader :session_id, :new_record
alias :new_record? :new_record
Something went wrong with that request. Please try again.