Devise/Warden/Rails: Server-side session store

5.2k views Asked by At

I'm using Devise in a Rails application, and I can set session data through the user_session hash. But all the session data is stored in a cookie, which causes network overhead and is potentially breakage-prone when the data gets larger than 4KB.

I'd much rather like to store session data on the server side, for example in the database, memcached, or even in memory (I'm not so worried about problems with load balancing). Before I go reinvent the wheel, is there some established way to do this?

(I know I could simply add fields to the user model, but I'd much rather like to just have a [JSON-serialized] free-form hash or so to keep it simple.)

1

There are 1 answers

6
thenengah On BEST ANSWER

You are looking for ActiveRecordStore. Here is the rails documentation.