Rails 2.3 - Storing sessions in different schema
Posted
by sa125
on Stack Overflow
See other posts from Stack Overflow
or by sa125
Published on 2010-06-06T09:55:26Z
Indexed on
2010/06/06
10:02 UTC
Read the original article
Hit count: 430
Hi -
I want to config my app to use a different schema than the default for storing sessions. Basically, I want the app to store all its active_record objects in app_development and only its sessions in app_sessions. Normally this could be done by defining the sessions db in database.yml:
development:
# ...
sessions:
host: localhost
database: app_sessions
username: blah
password: sssshhh
#....
And then setting in the model:
class Session < ActiveRecord::Base
establish_connection :sessions
#...
end
But since session doesn't have a model class defined, I'm looking for a way to tell it where to store its data. I've noticed the session comes from ActionController::Session
, but couldn't find what I needed there. Any thoughts? thanks.
© Stack Overflow or respective owner