[PATCH] SqlBypass session store doesn''t use ActiveRecord::Base connection

Luca Guidi
Tue, 31 Mar 2009 14:57:00 -0000

All the methods in ActiveRecord::SessionStore::SqlBypass use
@@connection class var, instead of the homonym class method. This of
course doesn''t not guarantee that var isn''t nil.

Try it by yourself:
# config/initializers/session_store.rb
ActionController::Base.session_store = :active_record_store
ActiveRecord::SessionStore.session_class ActiveRecord::SessionStore::SqlBypass


Then try to start the server and use sessions, it should raise a
`NoMethodError`.

I created a patch for solving this issue, but not the whole problem.
Since there aren''t unit tests for `ActiveRecord` session stores, but
only functional tests in `ActionPack`.

As you can see from the patch I replaced `@@connection` with
`connection` only where covered by tests.

LH Ticket: http://bit.ly/FGiaD

Cheers,
Luca
---
blog: www.lucaguidi.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---