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 =>
“User”
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 )
end

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

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

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

kad