Reputation: 10218
I have a Rails 3 application that uses the default CookieStore
. The application also has an admin section for which the controllers inherit from a base admin controller. I'd like to use ActiveRecordStore
for the admin pages, while continuing to use CookieStore
for everything else.
Why not use cookies for everything? I need to store large per-session values for admin pages.
(I'm open to the possibility that I've structured my app incorrectly. Being new to Rails, it seems like the main app and the admin section should be separate apps that share certain parts like models, but I haven't found any examples of this approach.)
Upvotes: 0
Views: 1267
Reputation: 1221
I don't think it's possible to change the session store per-controller, as the session data is load/unloaded using a middleware.
$ rake middleware
...
use ActionDispatch::Session::CookieStore
...
I think you better off using Active Record store for the whole site. Normal user won't be able to view the session data anyway, so it still safe. Or better, use some kind of NoSQL store if you worry about your SQL server performance. However, noted that Memcached can have only 1MB of data per key :)
Upvotes: 2