method

session_store=

rails latest stable - Class: ActionController::SessionManagement::ClassMethods

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

session_store=(store)
public

Set the session store to be used for keeping the session data between requests. By default, sessions are stored in browser cookies (:cookie_store), but you can also specify one of the other included stores (:active_record_store, :mem_cache_store, or your own custom class.

1Note

Using memcached as a session store

mutru ยท Jun 18, 20088 thanks

Because of Ruby's CGI library limitations, +store+ cannot have any configuration options. Basically this means that you cannot easily run memcached on a different port (or with any non-default settings for that matter).

You can bypass this limitation with this ugly hack (environment.rb):

cache_params = *([memcache_servers, memcache_options].flatten)
CACHE = MemCache.new(*cache_params)
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.merge!({ 'cache' => CACHE })

In your initializer block, just configure session_store normally:

config.session_store = :mem_cache_store

I think this should be fixed to work like +cache_store=+ does.