I am working with mapping ActiveRecord onto a legacy database. All is going well (using set_table_name, set_primary_key, etc), but I can''t get my many<=>many relationships to work. My contrived example of the situation: Student has_and_belongs_to_many Teachers. This is mapped via table student2teacher where the foreign keys are studentId and teacherId. The primary key in Student is studentId, and in Teacher is teacherId. However, when I run my unit tests I am getting this error: Mysql::Error: Unknown column ''j.student_id'' in ''where clause'' This is confusing, because I explicity specify that the association foreign key is studentId, not student_id. Any idea what I''m doing wrong here? Thanks. Student < ActiveRecord::Base set_table_name :student set_primary_key :studentId has_and_belongs_to_many :teachers, :join_table => ''student2teacher'', :association_foreign_key => ''studentId'' end Teacher < ActiveRecord::Base set_table_name :teacher set_primary_key :teacherId has_and_belongs_to_many :students, :join_table => ''student2teacher'', :association_foreign_key => ''teacherId'' end _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails