Rails 2.3以降でのセッションの設定場所
Rails 2.3系列のsession_optionsの設定の仕方がわかりにくい件 - 狐の王国を見て思ったのですが,意外に設定場所があるの知られてないようです.
(確か)Rails 2.x から,config/initializers/ と言うフォルダができており,アプリケーションの初期設定はここに書かれるようです.そして Rails 2.3 からはここに session_store.rb というファイルがあります.
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.session = { :key => '_rails-2.3.2_session', :secret => 'randamstring' } # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rake db:sessions:create") # ActionController::Base.session_store = :active_record_store
セッション関係の設定はここに記載します.たとえば先ほどの例では下記のようになります.
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.session = { :key => '_MyApp_session', :secret => 'randamstring', :cookie_only => false } # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rake db:sessions:create") # ActionController::Base.session_store = :active_record_store
こういう変化ってバージョンアップではわかりづらいので,Rails 新バージョンが出た際には新規に軽くアプリ作って,新規ファイルなど確認するのがいいのではと思います.