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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---