jpmobileのセッション設定
設定ファイルの修正
Rails 2.3 からは config/initializers/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 = { # ここが長いと URL が長くなってしまい、携帯端末によっては # 欠落する可能性があるので、少し短くしておきます。 :key => '_session_id', # Rails 2.3 以降では、Cookieが使える場合にはセッションパラメータよりも # Cookieが優先されますので、:cookie_only => false を追加します。 :cookie_only => false, :secret => 'hogehoge' } # 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
セッションテーブルを作成する
準備ができたら実際にセッションを管理するテーブルを作成します。
rake db:sessions:create rake db:migrate