Sessions in Rails 2.3?

Hi guys, new here so bonjour..

Sorry if this question has been asked, but i had a good look and i'm just generally confused about this at the moment!

ive been learning rails for about 4 months now and im on to sessions and more importantly where there stored, i have "Agile web development" and the lydna screencasts which both talk about sessions.

However the agile web development book describes these as ActiveRecordStore, which no longer exists?

and is using an old unscalable file system method?

Is there a nice guide, long or short someone on the web that shows how to do sessions currently and preferably storing them in a database (mysql)?

Cheers, Alex

Currently Rails stores sessions in the browser and this is the most scalable solution found until now.

Unless you have a really great idea to build a better session store, just use the cookie based one and you're done.

I have memcached based sessions (i.e. config/environment.rb “config.action_controller.session_store = :mem_cache_store”) from before 2.3. Are their any issues I should I keep in mind if I switch to the new hotness?

Man, that phrase sounds dated!



Yes, you can't have a lot of objects in the session using the cookie based session store, but this shouldn't be a problem if you're just storing things like the flash or user ids on it.

Hi Alex,

If you're using rails 2.3.2, take a look at ./config/initializers/ session_store.rb. There you'll see what you're looking for:

... #ActionController::Base.session_store = :active_record_store ...