Authlogic, Passenger, and cookie_store Sessions Don't Mix

There seems to be a problem with Authlogic, Passenger, and cookie_store sessions. You can read some details on this github commit.

A lot of the commenters keep saying that it gets fixed for them with newer versions of rails/passenger, but I’m having trouble with the rails 2.3.4, passenger 2.2.5, and authlogic 2.1.2 (all the latest versions as of this post). It was working fine at some point…

The fix? Use the old :active_record_store.

Add the following to config/environment.rb:

config.action_controller.session_store = :active_record_store

Then run

rake db:sessions:create

For PostgreSQL, I changed the migration it generates to the following:

class CreateSessions < ActiveRecord::Migration
  def self.up
    create_table :sessions do |t|
      t.text :session_id, :null => false
      t.text :data
      t.timestamps
    end

    add_index :sessions, :session_id
    add_index :sessions, :updated_at
  end

  def self.down
    drop_table :sessions
  end
end   

(column type for :session_id changed from string to text).

I imagine that :mem_cache_store would fix it as well…


Related Posts

  1. iPhone/iPad UISearchBar and UISearchDisplayController Asynchronous Example
  2. Rails Fragment Caching With Multiple Accounts
  3. Feedtools Database Cache
  4. SPF Records with Rails and ActionMailer
  5. Getting Rails 2 Release Candidate To Work
You should follow me on Twitter: @patrickxb