If you use migrations to create a join table for a HABTM relationship, you should tell rails not to automatically add an id column in the migration (Agile book - 271).
Otherwise you will get a
Mysql::Error: Duplicate entry '#' for key #error.
create_table :authors_books, :id => false do |t|
t.column :author_id, :integer, :null => false
t.column :book_id, :integer, :null => false
end