This project is archived and is in readonly mode.
Edge rails sessions not getting stored to database
-
josh
- Milestone cleared.
I think the plugin may have to be updated to work with Rack. It still may be based on the CGI stuff.
-
Nate Wiger
Josh, thanks for the quick reply. I have a git fork of it, as I suspected as much. Any pointers so I can make the changes? That way I can push it so when 2.3 comes out SqlSessionStore will be compatible.
My fork is at:
-
josh
If you inherit from ActionController::Session::AbstractStore, you just need to supply 2 methods: get_session and set_session.
See the AR session store for a good example.
http://github.com/josh/rails/blo...
After that should session store "should" be compatible with any rack application, merb, sinatra, etc.
-
Nate Wiger
Thanks for the pointer, but Josh, I'm stumped. I tried following that class and rewrote SqlSessionStore as follows:
class SqlSessionStore < ActionController::Session::AbstractStore
cattr_accessor :session_class self.session_class = SqlSession class << self # Rack-ism for Rails 2.3.0 SESSION_RECORD_KEY = 'rack.session.record'.freeze # For Rack compatibility (Rails 2.3.0+) def get_session(env, sid) sid ||= generate_sid session = session_class.find_session(sid) env[SESSION_RECORD_KEY] = session [sid, session.data] end # For Rack compatibility (Rails 2.3.0+) def set_session(env, sid, session_data) session = env[SESSION_RECORD_KEY] session.update_session(session_data) end endend
Then in config/environment.rb:
config.action_controller.session_store = :sql_session_store SqlSessionStore.session_class = OracleSession
No worky.
What am I missing?
-
Nate Wiger
FYI I pushed my (unstable) Rack session mods to my git fork:
git://github.com/nateware/sql_session_store.git
-
Nate Wiger
By the way, the oddity is that I would think setting:
config.action_controller.session_store = :sql_session_store SqlSessionStore.session_class = OracleSessionShould, if the SqlSessionStore class is not implemented correctly, raise an error like:
Undefined method 'get_session' for #<SqlSessionStore:Class>But that doesn't happen. In fact it seems like SqlSessionStore is never called by the session store callbacks??
-
josh
get_session and set_session should be instance methods, not class methods. You can also delete all the CGI api methods, they are unless now. So close, delete, restore, etc can be removed.
-
josh
- State changed from new to invalid
Hey, just ping me at josh at joshpeek dot com if you need anymore help porting the thing over to rack.
(Closing because the plugin needs to be updated)