Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for SqlBypass session store (for master) #2042

Merged
merged 1 commit into from Jul 12, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions activerecord/lib/active_record/session_store.rb
Expand Up @@ -181,11 +181,6 @@ def raise_on_session_data_overflow!
class SqlBypass
extend ClassMethods

##
# :singleton-method:
# Use the ActiveRecord::Base.connection by default.
cattr_accessor :connection

##
# :singleton-method:
# The table name defaults to 'sessions'.
Expand All @@ -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.
Expand All @@ -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
Expand Down