Altering your Session Key in Rails 2.3

No comments:
I am working on a 'toy' application that I started a couple of Rails releases ago. When I ran my test suite, I received the following warning:

DEPRECATION WARNING: Disabling sessions for a single controller has been deprecated. Sessions are now lazy loaded. So if you don't access them, consider them off. You can still modify the session cookie options with request.session_options.. (called from /Users/docondev/[...]/app/controllers/application_controller.rb:9)

The line in question follows:
session :session_key => '_docondev_session_id'

I learned this technique from several RoR books written only a couple of years ago, but there is a better way to alter the session key.

Although I could have altered the line in application_controller.rb, I decided to put the settings in a more appropriate location. I removed the line from the application-controller entirely. I then altered the config/initializers/session_store.rb file.

The changes should be fairly obvious, but note that :session_key and been changed to :key. I alter the secret by replacing the end of the string with my application name. This is really not necessary, but it is a habit I've established, it does no harm, and it keeps my key and secret visually coupled.

ActionController::Base.session = {
:key => '_docondev_store_session',
:secret => '005000374cbcd1[...]docondev'
}