I'm trying to build a "just click on your name to login" system using auth\_logic. My user model has an email and name field. To login, I simply do:

```
UserSession.create(@user, true)

```

Unfortunately that doesn't result in a session being created. Using a debugger I found this message:

```
#<UserSession: {:unauthorized_record=>"<protected>"}>

```

My user model just has one line:

```
acts_as_authentic

```

User session line has this, which I found somewhere. I'm not sure what it does and I've tried with and without:

```
class UserSession < Authlogic::Session::Base
  def to_key
     new_record? ? nil : [ self.send(self.class.primary_key) ]
  end
end

```

The database (I'm also not sure if that user\_sessions table is needed):

```
create_table "sessions", :force => true do |t|
  t.string   "session_id", :null => false
  t.text     "data"
  t.datetime "created_at"
  t.datetime "updated_at"
end

add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"

create_table "user_sessions", :force => true do |t|
  t.datetime "created_at"
  t.datetime "updated_at"
end

create_table "users", :force => true do |t|
  t.datetime "created_at"
  t.datetime "updated_at"
  t.string   "persistence_token"
  t.string   "email"
  t.string   "name"
end

```

I'm using Rails 3.0.9 and my Gemfile says (I tried both the normal and the Github authlogic gem):

```
gem 'rails', '3.0.9'
gem 'sqlite3'
gem "authlogic" #, :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'

```

[Here](https://github.com/Sjors/moneRideShare/tree/c5741dac3957631a075b5cae27354f89f668e281)'s the rest of the source code.

I had this problem a few days ago on a similar project and it "just went away" at some point. I just don't remember how.

Any ideas? This is driving me nuts...