Got SQL error (no id) when updating a join table

I am using a join table ‘credentials’ w a self-referenced ‘users’ table
defined as follows:

class User < ActiveRecord::Base
has_many :credentials_as_referee, :foreign_key => ‘referee_id’,
:class_name => ‘Credential’
has_many :credentials_as_referenced_user, :foreign_key =>
‘referenced_user_id’, :class_name => ‘Credential’
has_many :referees, :through => :credentials_as_referenced_user
has_many :referenced_users, :through => :credentials_as_referee

class Credential < ActiveRecord::Base
belongs_to :referee, :foreign_key => “referee_id”, :class_name =>
belongs_to :referenced_user, :foreign_key => “referenced_user_id”,
:class_name => “User”

# Activates the credential in the database.
def activate (category)
update_attributes( :activation_code => nil, :credential_category
=> category )

creating credential records works fine…
but trying to update a credential record from my controller :

@credential = Credential.find_by_activation_code(params[:id])

throws an SQL error :

Mysql::Error: Unknown column ‘id’ in ‘where clause’:
UPDATE credentials SET activation_code = NULL, credential_category
= 2, WHERE id = NULL

obviously the credentials table doesn’t need an id as a join table…
what’s wrong with the update_attributes… in my model ?

thanks fyl