README.markdown

Authlogic example

My own authlogic playground, with Rails 3 info from this post, plus bits of other functionality/explanation.

Add authlogic and its generators to our Gemfile

gem'authlogic'gem'rails3-generators'

Run bundle install as usual.

Create an authlogic session

rails g authlogic:session UserSession --fixture=false

This creates an empty UserSession model that derives from Authlogic::Session::Base. We add the
--fixture=false to prevent the creation of a user_sessions.yml fixture file. If the file is created, when tests are run, Rails will try to delete the data from a non-exstent user_sessions table, causing test failure.

Authlogic user sessions look like ActiveRecord models, but aren't--they're not backed by a table. They're an AR-like mapping of a user's sessions.

Create (or update) a user model

We'll assume our user model is named User (creative!). If we already have one, we can add a bunch of fields to it via a migration, otherwise we'll create a new one.