diff options
author | Joseph Wong <joseph.wong@sap.com> | 2011-07-08 13:21:38 -0700 |
---|---|---|
committer | Joseph Wong <joseph.wong@sap.com> | 2011-07-12 11:10:25 -0700 |
commit | 88e6c062423638df667869292050802d674bc0fa (patch) | |
tree | 7fb5c4a8c75b6d7661a9c80b17f63e20a7cebe67 | |
parent | e4479b2f1bc54edf155408d51dd3236955150ce1 (diff) | |
download | rails-88e6c062423638df667869292050802d674bc0fa.tar.gz rails-88e6c062423638df667869292050802d674bc0fa.tar.bz2 rails-88e6c062423638df667869292050802d674bc0fa.zip |
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
-rw-r--r-- | activerecord/lib/active_record/session_store.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index 929559c3ba..07b96343b9 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -183,11 +183,6 @@ module ActiveRecord ## # :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 @@ module ActiveRecord 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 @@ module ActiveRecord end end end + + delegate :connection, :connection=, :connection_pool, :connection_pool=, :to => self attr_reader :session_id, :new_record alias :new_record? :new_record |